annotate indeo3.c @ 12197:fbf4d5b1b664 libavcodec

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