1 /*
2 * Bitmap Brothers JV video decoder
3 * Copyright (c) 2011 Peter Ross <pross@xvid.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * Bitmap Brothers JV video decoder
25 * @author Peter Ross <pross@xvid.org>
26 */
27
33
40
42 {
44
48
51 return 0;
52 }
53
54 /**
55 * Decode 2x2 block
56 */
58 {
60
62 case 1:
64 for (j = 0; j < 2; j++)
65 memset(dst + j*linesize, v[0], 2);
66 break;
67 case 2:
70 for (j = 0; j < 2; j++)
71 for (i = 0; i < 2; i++)
73 break;
74 case 3:
75 for (j = 0; j < 2; j++)
76 for (i = 0; i < 2; i++)
77 dst[j*linesize + i] =
get_bits(gb, 8);
78 }
79 }
80
81 /**
82 * Decode 4x4 block
83 */
85 {
87
89 case 1:
91 for (j = 0; j < 4; j++)
92 memset(dst + j*linesize, v[0], 4);
93 break;
94 case 2:
97 for (j = 2; j >= 0; j -= 2) {
98 for (i = 0; i < 4; i++)
100 for (i = 0; i < 4; i++)
101 dst[(j+1)*linesize + i] = v[
get_bits1(gb)];
102 }
103 break;
104 case 3:
105 for (j = 0; j < 4; j += 2)
106 for (i = 0; i < 4; i += 2)
107 decode2x2(gb, dst + j*linesize + i, linesize);
108 }
109 }
110
111 /**
112 * Decode 8x8 block
113 */
115 {
117
119 case 1:
122 break;
123 case 2:
126 for (j = 7; j >= 0; j--)
127 for (i = 0; i < 8; i++)
129 break;
130 case 3:
131 for (j = 0; j < 8; j += 4)
132 for (i = 0; i < 8; i += 4)
133 decode4x4(gb, dst + j*linesize + i, linesize);
134 }
135 }
136
138 void *
data,
int *got_frame,
140 {
145
148
150 video_type = buf[4];
151 buf += 5;
152
153 if (video_size) {
154 if (video_size < 0 || video_size > avpkt->
size - 5) {
157 }
160
161 if (video_type == 0 || video_type == 1) {
164
165 for (j = 0; j < avctx->
height; j += 8)
166 for (i = 0; i < avctx->
width; i += 8)
169
171 } else if (video_type == 2) {
173 for (j = 0; j < avctx->
height; j++)
175 } else {
178 }
179 }
180
184 s->
palette[i] = 0xFFU << 24 | pal << 2 | ((pal >> 4) & 0x30303);
185 buf += 3;
186 }
188 }
189
190 if (video_size) {
196
199 *got_frame = 1;
200 }
201
203 }
204
206 {
208
210
211 return 0;
212 }
213
224 };