annotate indeo3.c @ 12409:91db982aaaad libavcodec

fixed some return values and deprecated CODEC_TYPE_VIDEO. dithering (faster) along a linear gradient now.
author bindhammer
date Tue, 24 Aug 2010 14:02:31 +0000
parents 914f484bb476
children ffb3668ff7af
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
12372
914f484bb476 Remove use of the deprecated function avcodec_check_dimensions(), use
stefano
parents: 12129
diff changeset
26 #include "libavcore/imgutils.h"
1190
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
9927
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
110 av_freep(&s->buf);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
111 if(!(s->buf = av_malloc(bufsize)))
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
112 return AVERROR(ENOMEM);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
113 s->iv_frame[0].y_w = s->iv_frame[1].y_w = luma_width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
114 s->iv_frame[0].y_h = s->iv_frame[1].y_h = luma_height;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
115 s->iv_frame[0].uv_w = s->iv_frame[1].uv_w = chroma_width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
116 s->iv_frame[0].uv_h = s->iv_frame[1].uv_h = chroma_height;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
117
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
118 s->iv_frame[0].Ybuf = s->buf + luma_width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
119 i = luma_pixels + luma_width * 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
120 s->iv_frame[1].Ybuf = s->buf + i;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
121 i += (luma_pixels + luma_width);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
122 s->iv_frame[0].Ubuf = s->buf + i;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
123 i += (chroma_pixels + chroma_width);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
124 s->iv_frame[1].Ubuf = s->buf + i;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
125 i += (chroma_pixels + chroma_width);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
126 s->iv_frame[0].Vbuf = s->buf + i;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
127 i += (chroma_pixels + chroma_width);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
128 s->iv_frame[1].Vbuf = s->buf + i;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
129
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
130 for(i = 1; i <= luma_width; i++)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
131 s->iv_frame[0].Ybuf[-i] = s->iv_frame[1].Ybuf[-i] =
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
132 s->iv_frame[0].Ubuf[-i] = 0x80;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
133
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
134 for(i = 1; i <= chroma_width; i++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
135 s->iv_frame[1].Ubuf[-i] = 0x80;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
136 s->iv_frame[0].Vbuf[-i] = 0x80;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
137 s->iv_frame[1].Vbuf[-i] = 0x80;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
138 s->iv_frame[1].Vbuf[chroma_pixels+i-1] = 0x80;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
139 }
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
140
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
141 return 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
142 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
143
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6450
diff changeset
144 static av_cold void iv_free_func(Indeo3DecodeContext *s)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
145 {
9928
16330a3b573b Change av_free to av_freep
reimar
parents: 9927
diff changeset
146 av_freep(&s->buf);
16330a3b573b Change av_free to av_freep
reimar
parents: 9927
diff changeset
147 av_freep(&s->ModPred);
16330a3b573b Change av_free to av_freep
reimar
parents: 9927
diff changeset
148 av_freep(&s->corrector_type);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
149 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
150
8314
e983153e2d72 Replace 'typedef struct ustr_t' by 'struct ustr', _t is POSIX namespace.
diego
parents: 7975
diff changeset
151 struct ustr {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
152 long xpos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
153 long ypos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
154 long width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
155 long height;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
156 long split_flag;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
157 long split_direction;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
158 long usl7;
8314
e983153e2d72 Replace 'typedef struct ustr_t' by 'struct ustr', _t is POSIX namespace.
diego
parents: 7975
diff changeset
159 };
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
160
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
161
1198
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
162 #define LV1_CHECK(buf1,rle_v3,lv1,lp2) \
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
163 if((lv1 & 0x80) != 0) { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
164 if(rle_v3 != 0) \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
165 rle_v3 = 0; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
166 else { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
167 rle_v3 = 1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
168 buf1 -= 2; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
169 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
170 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
171 lp2 = 4;
1198
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
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
174 #define RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3) \
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
175 if(rle_v3 == 0) { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
176 rle_v2 = *buf1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
177 rle_v1 = 1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
178 if(rle_v2 > 32) { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
179 rle_v2 -= 32; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
180 rle_v1 = 0; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
181 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
182 rle_v3 = 1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
183 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
184 buf1--;
1198
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
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
187 #define LP2_CHECK(buf1,rle_v3,lp2) \
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
188 if(lp2 == 0 && rle_v3 != 0) \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
189 rle_v3 = 0; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
190 else { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
191 buf1--; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
192 rle_v3 = 1; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
193 }
1198
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
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
196 #define RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2) \
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
197 rle_v2--; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
198 if(rle_v2 == 0) { \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
199 rle_v3 = 0; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
200 buf1 += 2; \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
201 } \
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
202 lp2 = 4;
1198
cae31b22b14e code redundancy reduction, courtesy of suxen_drol -at- hotmail.com
tmmm
parents: 1190
diff changeset
203
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
204 static void iv_Decode_Chunk(Indeo3DecodeContext *s,
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
205 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
206 const uint8_t *buf1, long cb_offset, const uint8_t *hdr,
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
207 const uint8_t *buf2, int min_width_160)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
208 {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
209 uint8_t bit_buf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
210 unsigned long bit_pos, lv, lv1, lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
211 long *width_tbl, width_tbl_arr[10];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
212 const signed char *ref_vectors;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
213 uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
214 uint32_t *cur_lp, *ref_lp;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
215 const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
216 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
217 struct ustr strip_tbl[20], *strip;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
218 int i, j, k, lp1, lp2, flag1, cmd, blks_width, blks_height, region_160_width,
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
219 rle_v1, rle_v2, rle_v3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
220 unsigned short res;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
221
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
222 bit_buf = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
223 ref_vectors = NULL;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
224
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
225 width_tbl = width_tbl_arr + 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
226 i = (width < 0 ? width + 3 : width)/4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
227 for(j = -1; j < 8; j++)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
228 width_tbl[j] = i * j;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
229
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
230 strip = strip_tbl;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
231
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
232 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
233
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
234 strip->ypos = strip->xpos = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
235 for(strip->width = min_width_160; width > strip->width; strip->width *= 2);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
236 strip->height = height;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
237 strip->split_direction = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
238 strip->split_flag = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
239 strip->usl7 = 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
240
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
241 bit_pos = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
242
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
243 rle_v1 = rle_v2 = rle_v3 = 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
244
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
245 while(strip >= strip_tbl) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
246 if(bit_pos <= 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
247 bit_pos = 8;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
248 bit_buf = *buf1++;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
249 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
250
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
251 bit_pos -= 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
252 cmd = (bit_buf >> bit_pos) & 0x03;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
253
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
254 if(cmd == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
255 strip++;
8669
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
256 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
257 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
258 break;
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
259 }
8323
fa328586b9ce indeo3: replace sizeof(struct ...) by sizeof(*var)
aurel
parents: 8314
diff changeset
260 memcpy(strip, strip-1, sizeof(*strip));
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
261 strip->split_flag = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
262 strip->split_direction = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
263 strip->height = (strip->height > 8 ? ((strip->height+8)>>4)<<3 : 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
264 continue;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
265 } else if(cmd == 1) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
266 strip++;
8669
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
267 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
268 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
269 break;
16b978f64d9e Fix an exploit in indeo by checking we are not writing out of the strip array.
benoit
parents: 8323
diff changeset
270 }
8323
fa328586b9ce indeo3: replace sizeof(struct ...) by sizeof(*var)
aurel
parents: 8314
diff changeset
271 memcpy(strip, strip-1, sizeof(*strip));
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
272 strip->split_flag = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
273 strip->split_direction = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
274 strip->width = (strip->width > 8 ? ((strip->width+8)>>4)<<3 : 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
275 continue;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
276 } else if(cmd == 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
277 if(strip->usl7 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
278 strip->usl7 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
279 ref_vectors = NULL;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
280 continue;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
281 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
282 } else if(cmd == 3) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
283 if(strip->usl7 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
284 strip->usl7 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
285 ref_vectors = (const signed char*)buf2 + (*buf1 * 2);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
286 buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
287 continue;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
288 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
289 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
290
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
291 cur_frm_pos = cur + width * strip->ypos + strip->xpos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
292
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
293 if((blks_width = strip->width) < 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
294 blks_width += 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
295 blks_width >>= 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
296 blks_height = strip->height;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
297
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
298 if(ref_vectors != NULL) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
299 ref_frm_pos = ref + (ref_vectors[0] + strip->ypos) * width +
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
300 ref_vectors[1] + strip->xpos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
301 } else
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
302 ref_frm_pos = cur_frm_pos - width_tbl[4];
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
303
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
304 if(cmd == 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
305 if(bit_pos <= 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
306 bit_pos = 8;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
307 bit_buf = *buf1++;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
308 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
309
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
310 bit_pos -= 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
311 cmd = (bit_buf >> bit_pos) & 0x03;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
312
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
313 if(cmd == 0 || ref_vectors != NULL) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
314 for(lp1 = 0; lp1 < blks_width; lp1++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
315 for(i = 0, j = 0; i < blks_height; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
316 ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
317 cur_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
318 ref_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
319 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
320 } else if(cmd != 1)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
321 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
322 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
323 k = *buf1 >> 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
324 j = *buf1 & 0x0f;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
325 buf1++;
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
326 lv = j + cb_offset;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
327
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
328 if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
329 cp2 = s->ModPred + ((lv - 8) << 7);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
330 cp = ref_frm_pos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
331 for(i = 0; i < blks_width << 2; i++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
332 int v = *cp >> 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
333 *(cp++) = cp2[v];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
334 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
335 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
336
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
337 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
338 lv = (hdr[j] & 0xf) + cb_offset;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
339 correction_type_sp[0] = s->corrector_type + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
340 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
341 lv = (hdr[j] >> 4) + cb_offset;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
342 correction_lp[1] = correction + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
343 correction_type_sp[1] = s->corrector_type + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
344 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
345 correctionloworder_lp[0] = correctionloworder_lp[1] = correctionloworder + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
346 correctionhighorder_lp[0] = correctionhighorder_lp[1] = correctionhighorder + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
347 correction_type_sp[0] = correction_type_sp[1] = s->corrector_type + (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
348 correction_lp[0] = correction_lp[1] = correction + (lv << 8);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
349 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
350
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
351 switch(k) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
352 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
353 case 0: /********** CASE 0 **********/
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
354 for( ; blks_height > 0; blks_height -= 4) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
355 for(lp1 = 0; lp1 < blks_width; lp1++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
356 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
357 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
358 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
359 ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2];
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
360
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
361 switch(correction_type_sp[0][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
362 case 0:
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
363 *cur_lp = av_le2ne32(((av_le2ne32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
364 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
365 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
366 case 1:
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
367 res = ((av_le2ne16(((unsigned short *)(ref_lp))[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
368 ((unsigned short *)cur_lp)[0] = av_le2ne16(res);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
369 res = ((av_le2ne16(((unsigned short *)(ref_lp))[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
370 ((unsigned short *)cur_lp)[1] = av_le2ne16(res);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
371 buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
372 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
373 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
374 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
375 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
376 for(i = 0, j = 0; i < 2; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
377 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
378 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
379 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
380 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
381 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
382 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
383 for(i = 0, j = 0; i < (3 - lp2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
384 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
385 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
386 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
387 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
388 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
389 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
390 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
391
7965
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
392 if(rle_v1 == 1 || ref_vectors != NULL) {
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
393 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
394 cur_lp[j] = ref_lp[j];
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
395 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
396
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
397 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
7965
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
398 break;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
399 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
400 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
401 rle_v2 = *buf1 - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
402 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
403 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
404 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
405 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
406 for(i = 0, j = 0; i < (4 - lp2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
407 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
408 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
409 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
410
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
411 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
412 if(rle_v3 != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
413 rle_v3 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
414 else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
415 buf1--;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
416 rle_v3 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
417 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
418 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
419 if(ref_vectors != NULL) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
420 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
421 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
422 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
423 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
424 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
425
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
426 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
427 lv1 = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
428 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
429 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
430 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
431 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
432 cur_lp[j] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
433
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
434 LV1_CHECK(buf1,rle_v3,lv1,lp2)
7965
d4ae40057dd3 Fix indentation.
benoit
parents: 7964
diff changeset
435 break;
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
436 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
437 return;
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
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
441 cur_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
442 ref_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
443 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
444
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
445 cur_frm_pos += ((width - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
446 ref_frm_pos += ((width - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
447 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
448 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
449
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
450 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
451 case 3: /********** CASE 3 **********/
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
452 if(ref_vectors != NULL)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
453 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
454 flag1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
455
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
456 for( ; blks_height > 0; blks_height -= 8) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
457 for(lp1 = 0; lp1 < blks_width; lp1++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
458 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
459 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
460
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
461 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
462 ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
463
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
464 switch(correction_type_sp[lp2 & 0x01][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
465 case 0:
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
466 cur_lp[width_tbl[1]] = av_le2ne32(((av_le2ne32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
467 if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
468 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
469 else
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
470 cur_lp[0] = av_le2ne32(((av_le2ne32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
471 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
472 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
473
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
474 case 1:
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
475 res = ((av_le2ne16(((unsigned short *)ref_lp)[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
476 ((unsigned short *)cur_lp)[width_tbl[2]] = av_le2ne16(res);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
477 res = ((av_le2ne16(((unsigned short *)ref_lp)[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
478 ((unsigned short *)cur_lp)[width_tbl[2]+1] = av_le2ne16(res);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
479
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
480 if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
481 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
482 else
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
483 cur_lp[0] = cur_lp[width_tbl[1]];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
484 buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
485 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
486 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
487
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
488 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
489 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
490 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
491 cur_lp[j] = *ref_lp;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
492 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
493 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
494 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
495
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
496 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
497 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
498 for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
499 cur_lp[j] = *ref_lp;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
500 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
501 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
502 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
503
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
504 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
505 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
506 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
507
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
508 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
509 if(rle_v3 != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
510 rle_v3 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
511 else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
512 buf1--;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
513 rle_v3 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
514 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
515 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
516 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
517
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
518 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
519 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
520 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
521
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
522 if(rle_v1 == 1) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
523 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
524 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
525 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
526
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
527 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
528 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
529 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
530 rle_v2 = (*buf1) - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
531 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
532 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
533 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
534 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
535 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
536 for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
537 cur_lp[j] = *ref_lp;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
538 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
539 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
540
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
541 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
542 av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
543 lv1 = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
544 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
545 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
546 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
547
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
548 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
549 cur_lp[j] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
550
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
551 LV1_CHECK(buf1,rle_v3,lv1,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
552 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
553
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
554 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
555 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
556 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
557 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
558
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
559 cur_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
560 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
561
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
562 cur_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
563 flag1 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
564 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
565 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
566
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
567 case 10: /********** CASE 10 **********/
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
568 if(ref_vectors == NULL) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
569 flag1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
570
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
571 for( ; blks_height > 0; blks_height -= 8) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
572 for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
573 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
574 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
575 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
576 ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
577 lv1 = ref_lp[0];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
578 lv2 = ref_lp[1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
579 if(lp2 == 0 && flag1 != 0) {
9985
266bf83f634d Replace WORDS_BIGENDIAN with HAVE_BIGENDIAN
mru
parents: 9981
diff changeset
580 #if HAVE_BIGENDIAN
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
581 lv1 = lv1 & 0xFF00FF00;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
582 lv1 = (lv1 >> 8) | lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
583 lv2 = lv2 & 0xFF00FF00;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
584 lv2 = (lv2 >> 8) | lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
585 #else
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
586 lv1 = lv1 & 0x00FF00FF;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
587 lv1 = (lv1 << 8) | lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
588 lv2 = lv2 & 0x00FF00FF;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
589 lv2 = (lv2 << 8) | lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
590 #endif
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
591 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
592
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
593 switch(correction_type_sp[lp2 & 0x01][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
594 case 0:
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
595 cur_lp[width_tbl[1]] = av_le2ne32(((av_le2ne32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
596 cur_lp[width_tbl[1]+1] = av_le2ne32(((av_le2ne32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
597 if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
598 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
599 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
600 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
601 cur_lp[0] = cur_lp[width_tbl[1]];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
602 cur_lp[1] = cur_lp[width_tbl[1]+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
603 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
604 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
605 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
606
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
607 case 1:
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
608 cur_lp[width_tbl[1]] = av_le2ne32(((av_le2ne32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
609 cur_lp[width_tbl[1]+1] = av_le2ne32(((av_le2ne32(lv2) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
610 if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
611 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
612 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
613 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
614 cur_lp[0] = cur_lp[width_tbl[1]];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
615 cur_lp[1] = cur_lp[width_tbl[1]+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
616 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
617 buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
618 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
619 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
620
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
621 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
622 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
623 if(flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
624 for(i = 0, j = width_tbl[1]; i < 3; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
625 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
626 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
627 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
628 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
629 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
630 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
631 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
632 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
633 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
634 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
635 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
636 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
637 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
638 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
639
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
640 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
641 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
642 if(lp2 == 0 && flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
643 for(i = 0, j = width_tbl[1]; i < 5; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
644 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
645 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
646 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
647 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
648 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
649 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
650 for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
651 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
652 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
653 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
654 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
655 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
656 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
657 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
658
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
659 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
660 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
661 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
662 if(rle_v1 == 1) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
663 if(flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
664 for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
665 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
666 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
667 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
668 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
669 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
670 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
671 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
672 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
673 cur_lp[j+1] = lv2;
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 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
677 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
678 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
679 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
680 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
681 rle_v2 = (*buf1) - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
682 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
683 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
684 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
685 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
686 if(lp2 == 0 && flag1 != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
687 for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
688 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
689 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
690 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
691 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
692 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
693 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
694 for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
695 cur_lp[j] = lv1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
696 cur_lp[j+1] = lv2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
697 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
698 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
699 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
700 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
701
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
702 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
703 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
704 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
705
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
706 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
707 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
708 if(rle_v3 != 0)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
709 rle_v3 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
710 else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
711 buf1--;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
712 rle_v3 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
713 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
714 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
715 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
716 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
717
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
718 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
719 av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
720 lv1 = *buf1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
721 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
722 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
723 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
724 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
725 cur_lp[j] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
726 LV1_CHECK(buf1,rle_v3,lv1,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
727 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
728
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
729 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
730 return;
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
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
734 cur_frm_pos += 8;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
735 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
736
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
737 cur_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
738 flag1 = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
739 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
740 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
741 for( ; blks_height > 0; blks_height -= 8) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
742 for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
743 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
744 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
745 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
746 ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
747
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
748 switch(correction_type_sp[lp2 & 0x01][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
749 case 0:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
750 lv1 = correctionloworder_lp[lp2 & 0x01][k];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
751 lv2 = correctionhighorder_lp[lp2 & 0x01][k];
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
752 cur_lp[0] = av_le2ne32(((av_le2ne32(ref_lp[0]) >> 1) + lv1) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
753 cur_lp[1] = av_le2ne32(((av_le2ne32(ref_lp[1]) >> 1) + lv2) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
754 cur_lp[width_tbl[1]] = av_le2ne32(((av_le2ne32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
755 cur_lp[width_tbl[1]+1] = av_le2ne32(((av_le2ne32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
756 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
757 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
758
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
759 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
760 lv1 = correctionloworder_lp[lp2 & 0x01][*buf1++];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
761 lv2 = correctionloworder_lp[lp2 & 0x01][k];
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
762 cur_lp[0] = av_le2ne32(((av_le2ne32(ref_lp[0]) >> 1) + lv1) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
763 cur_lp[1] = av_le2ne32(((av_le2ne32(ref_lp[1]) >> 1) + lv2) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
764 cur_lp[width_tbl[1]] = av_le2ne32(((av_le2ne32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
765 cur_lp[width_tbl[1]+1] = av_le2ne32(((av_le2ne32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
766 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
767 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
768
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
769 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
770 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
771 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
772 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
773 cur_lp[j+1] = ref_lp[j+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
774 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
775 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
776 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
777 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
778
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
779 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
780 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
781 for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
782 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
783 cur_lp[j+1] = ref_lp[j+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
784 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
785 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
786 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
787 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
788
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
789 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
790 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
791 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
792 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
793 ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
794 ((uint32_t *)cur_frm_pos)[j+1] = ((uint32_t *)ref_frm_pos)[j+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
795 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
796 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
797 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
798 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
799 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
800 rle_v2 = (*buf1) - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
801 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
802 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
803 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
804 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
805 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
806 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
807 for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
808 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
809 cur_lp[j+1] = ref_lp[j+1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
810 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
811 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
812 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
813
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
814 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
815 av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
816 lv1 = *buf1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
817 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
818 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
819 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
820 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
821 ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)cur_frm_pos)[j+1] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
822 LV1_CHECK(buf1,rle_v3,lv1,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
823 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
824
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
825 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
826 return;
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
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
830 cur_frm_pos += 8;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
831 ref_frm_pos += 8;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
832 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
833
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
834 cur_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
835 ref_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
836 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
837 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
838 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
839
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
840 case 11: /********** CASE 11 **********/
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
841 if(ref_vectors == NULL)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
842 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
843
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
844 for( ; blks_height > 0; blks_height -= 8) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
845 for(lp1 = 0; lp1 < blks_width; lp1++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
846 for(lp2 = 0; lp2 < 4; ) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
847 k = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
848 cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
849 ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
850
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
851 switch(correction_type_sp[lp2 & 0x01][k]) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
852 case 0:
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
853 cur_lp[0] = av_le2ne32(((av_le2ne32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
854 cur_lp[width_tbl[1]] = av_le2ne32(((av_le2ne32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
855 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
856 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
857
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
858 case 1:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
859 lv1 = (unsigned short)(correction_lp[lp2 & 0x01][*buf1++]);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
860 lv2 = (unsigned short)(correction_lp[lp2 & 0x01][k]);
12129
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
861 res = (unsigned short)(((av_le2ne16(((unsigned short *)ref_lp)[0]) >> 1) + lv1) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
862 ((unsigned short *)cur_lp)[0] = av_le2ne16(res);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
863 res = (unsigned short)(((av_le2ne16(((unsigned short *)ref_lp)[1]) >> 1) + lv2) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
864 ((unsigned short *)cur_lp)[1] = av_le2ne16(res);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
865 res = (unsigned short)(((av_le2ne16(((unsigned short *)ref_lp)[width_tbl[2]]) >> 1) + lv1) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
866 ((unsigned short *)cur_lp)[width_tbl[2]] = av_le2ne16(res);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
867 res = (unsigned short)(((av_le2ne16(((unsigned short *)ref_lp)[width_tbl[2]+1]) >> 1) + lv2) << 1);
8b28e74de2c0 Add av_ prefix to bswap macros
mru
parents: 12128
diff changeset
868 ((unsigned short *)cur_lp)[width_tbl[2]+1] = av_le2ne16(res);
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
869 lp2++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
870 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
871
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
872 case 2:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
873 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
874 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
875 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
876 lp2 += 2;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
877 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
878 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
879
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
880 case 3:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
881 if(lp2 < 2) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
882 for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
883 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
884 lp2 = 3;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
885 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
886 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
887
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
888 case 8:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
889 if(lp2 == 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
890 RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
891
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
892 for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
893 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
894
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
895 RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
896 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
897 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
898 rle_v1 = 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
899 rle_v2 = (*buf1) - 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
900 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
901 case 5:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
902 case 7:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
903 LP2_CHECK(buf1,rle_v3,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
904 case 4:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
905 case 6:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
906 for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
907 cur_lp[j] = ref_lp[j];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
908 lp2 = 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
909 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
910
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
911 case 9:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
912 av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
913 lv1 = *buf1++;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
914 lv = (lv1 & 0x7F) << 1;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
915 lv += (lv << 8);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
916 lv += (lv << 16);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
917 for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
918 cur_lp[j] = lv;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
919 LV1_CHECK(buf1,rle_v3,lv1,lp2)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
920 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
921
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
922 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
923 return;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
924 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
925 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
926
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
927 cur_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
928 ref_frm_pos += 4;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
929 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
930
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
931 cur_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
932 ref_frm_pos += (((width * 2) - blks_width) * 4);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
933 }
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
934 break;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
935
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
936 default:
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
937 return;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
938 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
939 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
940
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
941 for( ; strip >= strip_tbl; strip--) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
942 if(strip->split_flag != 0) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
943 strip->split_flag = 0;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
944 strip->usl7 = (strip-1)->usl7;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
945
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
946 if(strip->split_direction) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
947 strip->xpos += strip->width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
948 strip->width = (strip-1)->width - strip->width;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
949 if(region_160_width <= strip->xpos && width < strip->width + strip->xpos)
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
950 strip->width = width - strip->xpos;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
951 } else {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
952 strip->ypos += strip->height;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
953 strip->height = (strip-1)->height - strip->height;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
954 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
955 break;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
956 }
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
957 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
958 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
959 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
960
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6450
diff changeset
961 static av_cold int indeo3_decode_init(AVCodecContext *avctx)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
962 {
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
963 Indeo3DecodeContext *s = avctx->priv_data;
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
964 int ret = 0;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
965
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
966 s->avctx = avctx;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
967 s->width = avctx->width;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
968 s->height = avctx->height;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
969 avctx->pix_fmt = PIX_FMT_YUV410P;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
970
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
971 if (!(ret = build_modpred(s)))
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
972 ret = iv_alloc_frames(s);
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
973 if (ret)
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
974 iv_free_func(s);
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
975
7950
9d2399045441 Check allocations on init.
benoit
parents: 7949
diff changeset
976 return ret;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
977 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
978
9926
773041579748 Change iv_decode_frame to get AVCodecContext as argument, so that
reimar
parents: 9794
diff changeset
979 static int iv_decode_frame(AVCodecContext *avctx,
8988
48c89edff557 Reindent after last commit
alexc
parents: 8986
diff changeset
980 const uint8_t *buf, int buf_size)
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
981 {
9926
773041579748 Change iv_decode_frame to get AVCodecContext as argument, so that
reimar
parents: 9794
diff changeset
982 Indeo3DecodeContext *s = avctx->priv_data;
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
983 unsigned int image_width, image_height,
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
984 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
985 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
986 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
987 const uint8_t *hdr_pos, *buf_pos;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
988
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
989 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
990 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
991
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
992 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
993 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
994 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
995 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
996 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
997 image_width = bytestream_get_le16(&buf_pos);
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
998
12372
914f484bb476 Remove use of the deprecated function avcodec_check_dimensions(), use
stefano
parents: 12129
diff changeset
999 if(av_check_image_size(image_width, image_height, 0, avctx))
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1000 return -1;
9927
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1001 if (image_width != avctx->width || image_height != avctx->height) {
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1002 int ret;
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1003 avcodec_set_dimensions(avctx, image_width, image_height);
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1004 s->width = avctx->width;
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1005 s->height = avctx->height;
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1006 ret = iv_alloc_frames(s);
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1007 if (ret < 0) {
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1008 s->width = s->height = 0;
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1009 return ret;
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1010 }
f954ea120c78 Reallocate internal buffer when coded frame size changes.
reimar
parents: 9926
diff changeset
1011 }
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1012
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1013 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
1014 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
1015 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
1016 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
1017 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
1018 buf_pos += 4; /* reserved */
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1019 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
1020 if(data_size == 0x80) return 4;
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1021
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1022 if(FFMAX3(y_offset, v_offset, u_offset) >= buf_size-16) {
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1023 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
1024 return -1;
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1025 }
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1026
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1027 if(flags & 0x200) {
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1028 s->cur_frame = s->iv_frame + 1;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1029 s->ref_frame = s->iv_frame;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1030 } else {
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1031 s->cur_frame = s->iv_frame;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1032 s->ref_frame = s->iv_frame + 1;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1033 }
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1034
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1035 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
1036 mc_vector_count = bytestream_get_le32(&buf_pos);
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1037 if(2LL*mc_vector_count >= buf_size-16-y_offset) {
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1038 av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1039 return -1;
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1040 }
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1041
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1042 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
1043 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
1044 FFMIN(image_width, 160));
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1045
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1046 if (!(s->avctx->flags & CODEC_FLAG_GRAY))
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1047 {
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1048
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1049 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
1050 mc_vector_count = bytestream_get_le32(&buf_pos);
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1051 if(2LL*mc_vector_count >= buf_size-16-v_offset) {
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1052 av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1053 return -1;
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1054 }
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1055
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1056 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
1057 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
1058 FFMIN(chroma_width, 40));
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1059
7975
d9faf3f9f379 Rename some variables and add some comments to try to be a bit more clear.
benoit
parents: 7965
diff changeset
1060 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
1061 mc_vector_count = bytestream_get_le32(&buf_pos);
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1062 if(2LL*mc_vector_count >= buf_size-16-u_offset) {
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1063 av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1064 return -1;
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1065 }
7957
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1066
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1067 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
1068 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
1069 FFMIN(chroma_width, 40));
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1070
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1071 }
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1072
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1073 return 8;
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1074 }
fbe8fabdbc63 Move iv_decode_frame function to remove a forward declaration.
benoit
parents: 7956
diff changeset
1075
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1076 static int indeo3_decode_frame(AVCodecContext *avctx,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1077 void *data, int *data_size,
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8988
diff changeset
1078 AVPacket *avpkt)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1079 {
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8988
diff changeset
1080 const uint8_t *buf = avpkt->data;
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 8988
diff changeset
1081 int buf_size = avpkt->size;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1082 Indeo3DecodeContext *s=avctx->priv_data;
7947
70e83ea6a20a use uint8_t instead of unsigned char
benoit
parents: 7946
diff changeset
1083 uint8_t *src, *dest;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1084 int y;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1085
9926
773041579748 Change iv_decode_frame to get AVCodecContext as argument, so that
reimar
parents: 9794
diff changeset
1086 if (iv_decode_frame(avctx, buf, buf_size) < 0)
8986
4d5d7e08f1d3 Some buffer checks for indeo3
alexc
parents: 8670
diff changeset
1087 return -1;
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1088
1228
d63e0185a90f release buffer cleanup
michaelni
parents: 1198
diff changeset
1089 if(s->frame.data[0])
d63e0185a90f release buffer cleanup
michaelni
parents: 1198
diff changeset
1090 avctx->release_buffer(avctx, &s->frame);
d63e0185a90f release buffer cleanup
michaelni
parents: 1198
diff changeset
1091
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1092 s->frame.reference = 0;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1093 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
1094 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1095 return -1;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1096 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1097
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1098 src = s->cur_frame->Ybuf;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1099 dest = s->frame.data[0];
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1100 for (y = 0; y < s->height; y++) {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1101 memcpy(dest, src, s->cur_frame->y_w);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1102 src += s->cur_frame->y_w;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1103 dest += s->frame.linesize[0];
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1104 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1105
2244
4a0cfd63f078 greyscale decoding (option to skip u,v planes) support
alex
parents: 2028
diff changeset
1106 if (!(s->avctx->flags & CODEC_FLAG_GRAY))
4a0cfd63f078 greyscale decoding (option to skip u,v planes) support
alex
parents: 2028
diff changeset
1107 {
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1108 src = s->cur_frame->Ubuf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1109 dest = s->frame.data[1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1110 for (y = 0; y < s->height / 4; y++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1111 memcpy(dest, src, s->cur_frame->uv_w);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1112 src += s->cur_frame->uv_w;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1113 dest += s->frame.linesize[1];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1114 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1115
7955
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1116 src = s->cur_frame->Vbuf;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1117 dest = s->frame.data[2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1118 for (y = 0; y < s->height / 4; y++) {
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1119 memcpy(dest, src, s->cur_frame->uv_w);
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1120 src += s->cur_frame->uv_w;
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1121 dest += s->frame.linesize[2];
ade9fe6072ea Reindent whole file.
benoit
parents: 7954
diff changeset
1122 }
2244
4a0cfd63f078 greyscale decoding (option to skip u,v planes) support
alex
parents: 2028
diff changeset
1123 }
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1124
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1125 *data_size=sizeof(AVFrame);
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1126 *(AVFrame*)data= s->frame;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1127
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1128 return buf_size;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1129 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1130
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6450
diff changeset
1131 static av_cold int indeo3_decode_end(AVCodecContext *avctx)
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1132 {
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1133 Indeo3DecodeContext *s = avctx->priv_data;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1134
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1135 iv_free_func(s);
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1136
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1137 return 0;
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1138 }
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1139
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1140 AVCodec indeo3_decoder = {
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1141 "indeo3",
11560
8a4984c5cacc Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 9985
diff changeset
1142 AVMEDIA_TYPE_VIDEO,
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1143 CODEC_ID_INDEO3,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1144 sizeof(Indeo3DecodeContext),
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1145 indeo3_decode_init,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1146 NULL,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1147 indeo3_decode_end,
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1148 indeo3_decode_frame,
9794
fd3481a592b2 indeo3 decoder uses get_buffer, set CODEC_CAP_DR1
bcoudurier
parents: 9355
diff changeset
1149 CODEC_CAP_DR1,
6710
a4104482ceef Add long names to many AVCodec declarations.
diego
parents: 6517
diff changeset
1150 NULL,
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6710
diff changeset
1151 .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"),
1190
60bd91a6e218 native Indeo3 decoder implementation
tmmm
parents:
diff changeset
1152 };