Mercurial > libavcodec.hg
annotate wmv2.c @ 5932:d457f0c01ec5 libavcodec
cosmetic (x==NULL -> !x)
author | michael |
---|---|
date | Mon, 19 Nov 2007 20:33:25 +0000 |
parents | 83ac4620c6ed |
children | b47573cb7401 |
rev | line source |
---|---|
936 | 1 /* |
2 * Copyright (c) 2002 The FFmpeg Project. | |
3 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3741
diff
changeset
|
4 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3741
diff
changeset
|
5 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3741
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or |
936 | 7 * modify it under the terms of the GNU Lesser General Public |
8 * 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:
3741
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. |
936 | 10 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3741
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
936 | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * Lesser General Public License for more details. | |
15 * | |
16 * 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:
3741
diff
changeset
|
17 * 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
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
936 | 19 */ |
20 | |
1106 | 21 /** |
22 * @file wmv2.c | |
23 * wmv2 codec. | |
24 */ | |
2967 | 25 |
5884 | 26 #include "avcodec.h" |
27 #include "dsputil.h" | |
28 #include "mpegvideo.h" | |
29 #include "msmpeg4.h" | |
30 #include "msmpeg4data.h" | |
936 | 31 #include "simple_idct.h" |
5887 | 32 #include "intrax8.h" |
2967 | 33 |
936 | 34 #define SKIP_TYPE_NONE 0 |
35 #define SKIP_TYPE_MPEG 1 | |
36 #define SKIP_TYPE_ROW 2 | |
37 #define SKIP_TYPE_COL 3 | |
38 | |
39 | |
40 typedef struct Wmv2Context{ | |
41 MpegEncContext s; | |
5887 | 42 IntraX8Context x8; |
936 | 43 int j_type_bit; |
44 int j_type; | |
45 int abt_flag; | |
46 int abt_type; | |
47 int abt_type_table[6]; | |
48 int per_mb_abt; | |
49 int per_block_abt; | |
50 int mspel_bit; | |
51 int cbp_table_index; | |
52 int top_left_mv_flag; | |
53 int per_mb_rl_bit; | |
54 int skip_type; | |
55 int hshift; | |
2967 | 56 |
936 | 57 ScanTable abt_scantable[2]; |
3089 | 58 DECLARE_ALIGNED_8(DCTELEM, abt_block2[6][64]); |
936 | 59 }Wmv2Context; |
60 | |
61 static void wmv2_common_init(Wmv2Context * w){ | |
62 MpegEncContext * const s= &w->s; | |
2967 | 63 |
1273 | 64 ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[0], wmv2_scantableA); |
65 ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[1], wmv2_scantableB); | |
936 | 66 } |
67 | |
4950
665c61d35b52
Replace general CONFIG_ENCODERS by more fine-grained CONFIG_WMV2_ENCODER.
diego
parents:
4947
diff
changeset
|
68 #ifdef CONFIG_WMV2_ENCODER |
2024
f65d87bfdd5a
some of the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents:
1943
diff
changeset
|
69 |
936 | 70 static int encode_ext_header(Wmv2Context *w){ |
71 MpegEncContext * const s= &w->s; | |
72 PutBitContext pb; | |
73 int code; | |
2967 | 74 |
1524 | 75 init_put_bits(&pb, s->avctx->extradata, s->avctx->extradata_size); |
936 | 76 |
2637 | 77 put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29 |
936 | 78 put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047)); |
2967 | 79 |
936 | 80 put_bits(&pb, 1, w->mspel_bit=1); |
5193
19ed7e6ef927
Identify the loop_filter flag as such and remove the unused variables in the context.
iive
parents:
5178
diff
changeset
|
81 put_bits(&pb, 1, s->loop_filter); |
936 | 82 put_bits(&pb, 1, w->abt_flag=1); |
83 put_bits(&pb, 1, w->j_type_bit=1); | |
84 put_bits(&pb, 1, w->top_left_mv_flag=0); | |
85 put_bits(&pb, 1, w->per_mb_rl_bit=1); | |
86 put_bits(&pb, 3, code=1); | |
2967 | 87 |
936 | 88 flush_put_bits(&pb); |
89 | |
90 s->slice_height = s->mb_height / code; | |
2967 | 91 |
936 | 92 return 0; |
93 } | |
94 | |
95 static int wmv2_encode_init(AVCodecContext *avctx){ | |
96 Wmv2Context * const w= avctx->priv_data; | |
2967 | 97 |
936 | 98 if(MPV_encode_init(avctx) < 0) |
99 return -1; | |
2967 | 100 |
936 | 101 wmv2_common_init(w); |
102 | |
103 avctx->extradata_size= 4; | |
104 avctx->extradata= av_mallocz(avctx->extradata_size + 10); | |
105 encode_ext_header(w); | |
2967 | 106 |
936 | 107 return 0; |
108 } | |
109 | |
2522
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2474
diff
changeset
|
110 #if 0 /* unused, remove? */ |
936 | 111 static int wmv2_encode_end(AVCodecContext *avctx){ |
2967 | 112 |
936 | 113 if(MPV_encode_end(avctx) < 0) |
114 return -1; | |
2967 | 115 |
936 | 116 avctx->extradata_size= 0; |
117 av_freep(&avctx->extradata); | |
2967 | 118 |
936 | 119 return 0; |
120 } | |
2522
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2474
diff
changeset
|
121 #endif |
936 | 122 |
123 int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number) | |
124 { | |
125 Wmv2Context * const w= (Wmv2Context*)s; | |
126 | |
127 put_bits(&s->pb, 1, s->pict_type - 1); | |
128 if(s->pict_type == I_TYPE){ | |
129 put_bits(&s->pb, 7, 0); | |
130 } | |
131 put_bits(&s->pb, 5, s->qscale); | |
132 | |
133 s->dc_table_index = 1; | |
134 s->mv_table_index = 1; /* only if P frame */ | |
135 // s->use_skip_mb_code = 1; /* only if P frame */ | |
136 s->per_mb_rl_table = 0; | |
137 s->mspel= 0; | |
138 w->per_mb_abt=0; | |
139 w->abt_type=0; | |
140 w->j_type=0; | |
141 | |
1163 | 142 assert(s->flipflop_rounding); |
143 | |
936 | 144 if (s->pict_type == I_TYPE) { |
1163 | 145 assert(s->no_rounding==1); |
936 | 146 if(w->j_type_bit) put_bits(&s->pb, 1, w->j_type); |
2967 | 147 |
936 | 148 if(w->per_mb_rl_bit) put_bits(&s->pb, 1, s->per_mb_rl_table); |
2967 | 149 |
936 | 150 if(!s->per_mb_rl_table){ |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
151 ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index); |
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
152 ff_msmpeg4_code012(&s->pb, s->rl_table_index); |
936 | 153 } |
154 | |
155 put_bits(&s->pb, 1, s->dc_table_index); | |
156 | |
157 s->inter_intra_pred= 0; | |
158 }else{ | |
159 int cbp_index; | |
160 | |
161 put_bits(&s->pb, 2, SKIP_TYPE_NONE); | |
2967 | 162 |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
163 ff_msmpeg4_code012(&s->pb, cbp_index=0); |
936 | 164 if(s->qscale <= 10){ |
165 int map[3]= {0,2,1}; | |
166 w->cbp_table_index= map[cbp_index]; | |
167 }else if(s->qscale <= 20){ | |
168 int map[3]= {1,0,2}; | |
169 w->cbp_table_index= map[cbp_index]; | |
170 }else{ | |
171 int map[3]= {2,1,0}; | |
172 w->cbp_table_index= map[cbp_index]; | |
173 } | |
174 | |
175 if(w->mspel_bit) put_bits(&s->pb, 1, s->mspel); | |
2967 | 176 |
936 | 177 if(w->abt_flag){ |
178 put_bits(&s->pb, 1, w->per_mb_abt^1); | |
179 if(!w->per_mb_abt){ | |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
180 ff_msmpeg4_code012(&s->pb, w->abt_type); |
936 | 181 } |
182 } | |
183 | |
184 if(w->per_mb_rl_bit) put_bits(&s->pb, 1, s->per_mb_rl_table); | |
2967 | 185 |
936 | 186 if(!s->per_mb_rl_table){ |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
187 ff_msmpeg4_code012(&s->pb, s->rl_table_index); |
936 | 188 s->rl_chroma_table_index = s->rl_table_index; |
189 } | |
190 put_bits(&s->pb, 1, s->dc_table_index); | |
191 put_bits(&s->pb, 1, s->mv_table_index); | |
2967 | 192 |
1943 | 193 s->inter_intra_pred= 0;//(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE); |
936 | 194 } |
195 s->esc3_level_length= 0; | |
196 s->esc3_run_length= 0; | |
197 | |
198 return 0; | |
199 } | |
200 | |
5127 | 201 /* Nearly identical to wmv1 but that is just because we do not use the |
202 * useless M$ crap features. It is duplicated here in case someone wants | |
203 * to add support for these crap features. */ | |
2967 | 204 void ff_wmv2_encode_mb(MpegEncContext * s, |
936 | 205 DCTELEM block[6][64], |
206 int motion_x, int motion_y) | |
207 { | |
208 Wmv2Context * const w= (Wmv2Context*)s; | |
209 int cbp, coded_cbp, i; | |
210 int pred_x, pred_y; | |
1064 | 211 uint8_t *coded_block; |
936 | 212 |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
213 ff_msmpeg4_handle_slices(s); |
2967 | 214 |
936 | 215 if (!s->mb_intra) { |
2979 | 216 /* compute cbp */ |
217 cbp = 0; | |
218 for (i = 0; i < 6; i++) { | |
219 if (s->block_last_index[i] >= 0) | |
220 cbp |= 1 << (5 - i); | |
221 } | |
2967 | 222 |
223 put_bits(&s->pb, | |
224 wmv2_inter_table[w->cbp_table_index][cbp + 64][1], | |
936 | 225 wmv2_inter_table[w->cbp_table_index][cbp + 64][0]); |
226 | |
227 /* motion vector */ | |
1938
e2501e6e7ff7
unify table indexing (motion_val,dc_val,ac_val,coded_block changed)
michael
parents:
1668
diff
changeset
|
228 h263_pred_motion(s, 0, 0, &pred_x, &pred_y); |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
229 ff_msmpeg4_encode_motion(s, motion_x - pred_x, |
936 | 230 motion_y - pred_y); |
231 } else { | |
2979 | 232 /* compute cbp */ |
233 cbp = 0; | |
936 | 234 coded_cbp = 0; |
2979 | 235 for (i = 0; i < 6; i++) { |
936 | 236 int val, pred; |
237 val = (s->block_last_index[i] >= 1); | |
238 cbp |= val << (5 - i); | |
239 if (i < 4) { | |
240 /* predict value for close blocks only for luma */ | |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
241 pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block); |
936 | 242 *coded_block = val; |
243 val = val ^ pred; | |
244 } | |
245 coded_cbp |= val << (5 - i); | |
2979 | 246 } |
936 | 247 #if 0 |
248 if (coded_cbp) | |
249 printf("cbp=%x %x\n", cbp, coded_cbp); | |
250 #endif | |
251 | |
252 if (s->pict_type == I_TYPE) { | |
2967 | 253 put_bits(&s->pb, |
2474 | 254 ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]); |
936 | 255 } else { |
2967 | 256 put_bits(&s->pb, |
257 wmv2_inter_table[w->cbp_table_index][cbp][1], | |
936 | 258 wmv2_inter_table[w->cbp_table_index][cbp][0]); |
259 } | |
2979 | 260 put_bits(&s->pb, 1, 0); /* no AC prediction yet */ |
936 | 261 if(s->inter_intra_pred){ |
262 s->h263_aic_dir=0; | |
263 put_bits(&s->pb, table_inter_intra[s->h263_aic_dir][1], table_inter_intra[s->h263_aic_dir][0]); | |
264 } | |
265 } | |
266 | |
267 for (i = 0; i < 6; i++) { | |
5178 | 268 ff_msmpeg4_encode_block(s, block[i], i); |
936 | 269 } |
270 } | |
4950
665c61d35b52
Replace general CONFIG_ENCODERS by more fine-grained CONFIG_WMV2_ENCODER.
diego
parents:
4947
diff
changeset
|
271 #endif //CONFIG_WMV2_ENCODER |
936 | 272 |
273 static void parse_mb_skip(Wmv2Context * w){ | |
274 int mb_x, mb_y; | |
275 MpegEncContext * const s= &w->s; | |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1163
diff
changeset
|
276 uint32_t * const mb_type= s->current_picture_ptr->mb_type; |
936 | 277 |
278 w->skip_type= get_bits(&s->gb, 2); | |
279 switch(w->skip_type){ | |
280 case SKIP_TYPE_NONE: | |
281 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |
282 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1163
diff
changeset
|
283 mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_16x16 | MB_TYPE_L0; |
936 | 284 } |
285 } | |
286 break; | |
287 case SKIP_TYPE_MPEG: | |
288 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |
289 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1163
diff
changeset
|
290 mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; |
936 | 291 } |
292 } | |
293 break; | |
294 case SKIP_TYPE_ROW: | |
295 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |
296 if(get_bits1(&s->gb)){ | |
297 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1163
diff
changeset
|
298 mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; |
936 | 299 } |
300 }else{ | |
301 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1163
diff
changeset
|
302 mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; |
936 | 303 } |
304 } | |
305 } | |
306 break; | |
307 case SKIP_TYPE_COL: | |
308 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | |
309 if(get_bits1(&s->gb)){ | |
310 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1163
diff
changeset
|
311 mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; |
936 | 312 } |
313 }else{ | |
314 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1163
diff
changeset
|
315 mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; |
936 | 316 } |
317 } | |
318 } | |
319 break; | |
320 } | |
321 } | |
322 | |
323 static int decode_ext_header(Wmv2Context *w){ | |
324 MpegEncContext * const s= &w->s; | |
325 GetBitContext gb; | |
326 int fps; | |
327 int code; | |
328 | |
329 if(s->avctx->extradata_size<4) return -1; | |
2967 | 330 |
1025
1f9afd8b9131
GetBitContext.size is allways multiplied by 8 -> use size_in_bits to avoid useless *8 in a few inner loops
michaelni
parents:
983
diff
changeset
|
331 init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); |
936 | 332 |
333 fps = get_bits(&gb, 5); | |
334 s->bit_rate = get_bits(&gb, 11)*1024; | |
335 w->mspel_bit = get_bits1(&gb); | |
5193
19ed7e6ef927
Identify the loop_filter flag as such and remove the unused variables in the context.
iive
parents:
5178
diff
changeset
|
336 s->loop_filter = get_bits1(&gb); |
936 | 337 w->abt_flag = get_bits1(&gb); |
338 w->j_type_bit = get_bits1(&gb); | |
339 w->top_left_mv_flag= get_bits1(&gb); | |
340 w->per_mb_rl_bit = get_bits1(&gb); | |
341 code = get_bits(&gb, 3); | |
2967 | 342 |
936 | 343 if(code==0) return -1; |
1092 | 344 |
936 | 345 s->slice_height = s->mb_height / code; |
346 | |
347 if(s->avctx->debug&FF_DEBUG_PICT_INFO){ | |
5193
19ed7e6ef927
Identify the loop_filter flag as such and remove the unused variables in the context.
iive
parents:
5178
diff
changeset
|
348 av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, slices:%d\n", |
19ed7e6ef927
Identify the loop_filter flag as such and remove the unused variables in the context.
iive
parents:
5178
diff
changeset
|
349 fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter, |
983 | 350 code); |
936 | 351 } |
352 return 0; | |
353 } | |
354 | |
355 int ff_wmv2_decode_picture_header(MpegEncContext * s) | |
356 { | |
357 Wmv2Context * const w= (Wmv2Context*)s; | |
1183 | 358 int code; |
936 | 359 |
360 #if 0 | |
361 { | |
362 int i; | |
363 for(i=0; i<s->gb.size*8; i++) | |
364 printf("%d", get_bits1(&s->gb)); | |
365 // get_bits1(&s->gb); | |
366 printf("END\n"); | |
367 return -1; | |
368 } | |
369 #endif | |
370 if(s->picture_number==0) | |
371 decode_ext_header(w); | |
372 | |
5513 | 373 s->pict_type = get_bits1(&s->gb) + 1; |
936 | 374 if(s->pict_type == I_TYPE){ |
375 code = get_bits(&s->gb, 7); | |
2810 | 376 av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code); |
936 | 377 } |
1651 | 378 s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); |
1183 | 379 if(s->qscale < 0) |
380 return -1; | |
2967 | 381 |
1183 | 382 return 0; |
383 } | |
384 | |
385 int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s) | |
386 { | |
387 Wmv2Context * const w= (Wmv2Context*)s; | |
936 | 388 |
389 if (s->pict_type == I_TYPE) { | |
390 if(w->j_type_bit) w->j_type= get_bits1(&s->gb); | |
391 else w->j_type= 0; //FIXME check | |
2967 | 392 |
936 | 393 if(!w->j_type){ |
394 if(w->per_mb_rl_bit) s->per_mb_rl_table= get_bits1(&s->gb); | |
395 else s->per_mb_rl_table= 0; | |
2967 | 396 |
936 | 397 if(!s->per_mb_rl_table){ |
398 s->rl_chroma_table_index = decode012(&s->gb); | |
399 s->rl_table_index = decode012(&s->gb); | |
400 } | |
401 | |
402 s->dc_table_index = get_bits1(&s->gb); | |
403 } | |
404 s->inter_intra_pred= 0; | |
405 s->no_rounding = 1; | |
406 if(s->avctx->debug&FF_DEBUG_PICT_INFO){ | |
2979 | 407 av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n", |
408 s->qscale, | |
409 s->rl_chroma_table_index, | |
410 s->rl_table_index, | |
411 s->dc_table_index, | |
936 | 412 s->per_mb_rl_table, |
413 w->j_type); | |
414 } | |
415 }else{ | |
416 int cbp_index; | |
417 w->j_type=0; | |
418 | |
419 parse_mb_skip(w); | |
420 cbp_index= decode012(&s->gb); | |
421 if(s->qscale <= 10){ | |
422 int map[3]= {0,2,1}; | |
423 w->cbp_table_index= map[cbp_index]; | |
424 }else if(s->qscale <= 20){ | |
425 int map[3]= {1,0,2}; | |
426 w->cbp_table_index= map[cbp_index]; | |
427 }else{ | |
428 int map[3]= {2,1,0}; | |
429 w->cbp_table_index= map[cbp_index]; | |
430 } | |
431 | |
432 if(w->mspel_bit) s->mspel= get_bits1(&s->gb); | |
433 else s->mspel= 0; //FIXME check | |
2967 | 434 |
936 | 435 if(w->abt_flag){ |
436 w->per_mb_abt= get_bits1(&s->gb)^1; | |
437 if(!w->per_mb_abt){ | |
438 w->abt_type= decode012(&s->gb); | |
439 } | |
440 } | |
441 | |
442 if(w->per_mb_rl_bit) s->per_mb_rl_table= get_bits1(&s->gb); | |
443 else s->per_mb_rl_table= 0; | |
2967 | 444 |
936 | 445 if(!s->per_mb_rl_table){ |
446 s->rl_table_index = decode012(&s->gb); | |
447 s->rl_chroma_table_index = s->rl_table_index; | |
448 } | |
449 | |
450 s->dc_table_index = get_bits1(&s->gb); | |
451 s->mv_table_index = get_bits1(&s->gb); | |
2967 | 452 |
1943 | 453 s->inter_intra_pred= 0;//(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE); |
936 | 454 s->no_rounding ^= 1; |
2967 | 455 |
936 | 456 if(s->avctx->debug&FF_DEBUG_PICT_INFO){ |
2967 | 457 av_log(s->avctx, AV_LOG_DEBUG, "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n", |
2979 | 458 s->rl_table_index, |
459 s->rl_chroma_table_index, | |
460 s->dc_table_index, | |
461 s->mv_table_index, | |
936 | 462 s->per_mb_rl_table, |
463 s->qscale, | |
464 s->mspel, | |
465 w->per_mb_abt, | |
466 w->abt_type, | |
467 w->cbp_table_index, | |
468 s->inter_intra_pred); | |
469 } | |
470 } | |
471 s->esc3_level_length= 0; | |
472 s->esc3_run_length= 0; | |
2967 | 473 |
936 | 474 s->picture_number++; //FIXME ? |
475 | |
476 | |
477 if(w->j_type){ | |
5887 | 478 ff_intrax8_decode_picture(&w->x8, 2*s->qscale, (s->qscale-1)|1 ); |
479 return 1; | |
936 | 480 } |
481 | |
482 return 0; | |
483 } | |
484 | |
485 static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){ | |
486 MpegEncContext * const s= &w->s; | |
487 int ret; | |
2967 | 488 |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
489 ret= ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr); |
2967 | 490 |
936 | 491 if(ret<0) return -1; |
2967 | 492 |
936 | 493 if((((*mx_ptr)|(*my_ptr)) & 1) && s->mspel) |
494 w->hshift= get_bits1(&s->gb); | |
2967 | 495 else |
936 | 496 w->hshift= 0; |
497 | |
498 //printf("%d %d ", *mx_ptr, *my_ptr); | |
2967 | 499 |
936 | 500 return 0; |
501 } | |
502 | |
503 static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){ | |
504 MpegEncContext * const s= &w->s; | |
505 int xy, wrap, diff, type; | |
1064 | 506 int16_t *A, *B, *C, *mot_val; |
936 | 507 |
1938
e2501e6e7ff7
unify table indexing (motion_val,dc_val,ac_val,coded_block changed)
michael
parents:
1668
diff
changeset
|
508 wrap = s->b8_stride; |
936 | 509 xy = s->block_index[0]; |
510 | |
1668
30746f429df6
move motion_val & mb_type to AVFrame patch by (Wolfgang Hesseler <qv at multimediaware dot com>)
michael
parents:
1651
diff
changeset
|
511 mot_val = s->current_picture.motion_val[0][xy]; |
936 | 512 |
1668
30746f429df6
move motion_val & mb_type to AVFrame patch by (Wolfgang Hesseler <qv at multimediaware dot com>)
michael
parents:
1651
diff
changeset
|
513 A = s->current_picture.motion_val[0][xy - 1]; |
30746f429df6
move motion_val & mb_type to AVFrame patch by (Wolfgang Hesseler <qv at multimediaware dot com>)
michael
parents:
1651
diff
changeset
|
514 B = s->current_picture.motion_val[0][xy - wrap]; |
30746f429df6
move motion_val & mb_type to AVFrame patch by (Wolfgang Hesseler <qv at multimediaware dot com>)
michael
parents:
1651
diff
changeset
|
515 C = s->current_picture.motion_val[0][xy + 2 - wrap]; |
2967 | 516 |
2818 | 517 if(s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag) |
4001 | 518 diff= FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1])); |
2967 | 519 else |
2818 | 520 diff=0; |
2967 | 521 |
2818 | 522 if(diff >= 8) |
936 | 523 type= get_bits1(&s->gb); |
524 else | |
525 type= 2; | |
2967 | 526 |
936 | 527 if(type == 0){ |
528 *px= A[0]; | |
529 *py= A[1]; | |
530 }else if(type == 1){ | |
531 *px= B[0]; | |
532 *py= B[1]; | |
533 }else{ | |
534 /* special case for first (slice) line */ | |
535 if (s->first_slice_line) { | |
536 *px = A[0]; | |
537 *py = A[1]; | |
538 } else { | |
539 *px = mid_pred(A[0], B[0], C[0]); | |
540 *py = mid_pred(A[1], B[1], C[1]); | |
541 } | |
542 } | |
543 | |
544 return mot_val; | |
545 } | |
546 | |
547 static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n, int cbp){ | |
548 MpegEncContext * const s= &w->s; | |
549 static const int sub_cbp_table[3]= {2,3,1}; | |
550 int sub_cbp; | |
551 | |
2967 | 552 if(!cbp){ |
936 | 553 s->block_last_index[n] = -1; |
554 | |
555 return 0; | |
556 } | |
2967 | 557 |
936 | 558 if(w->per_block_abt) |
559 w->abt_type= decode012(&s->gb); | |
560 #if 0 | |
561 if(w->per_block_abt) | |
562 printf("B%d", w->abt_type); | |
563 #endif | |
564 w->abt_type_table[n]= w->abt_type; | |
565 | |
566 if(w->abt_type){ | |
567 // const uint8_t *scantable= w->abt_scantable[w->abt_type-1].permutated; | |
568 const uint8_t *scantable= w->abt_scantable[w->abt_type-1].scantable; | |
569 // const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable; | |
570 | |
571 sub_cbp= sub_cbp_table[ decode012(&s->gb) ]; | |
572 // printf("S%d", sub_cbp); | |
573 | |
574 if(sub_cbp&1){ | |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
575 if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0) |
936 | 576 return -1; |
577 } | |
2967 | 578 |
936 | 579 if(sub_cbp&2){ |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
580 if (ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable) < 0) |
936 | 581 return -1; |
582 } | |
583 s->block_last_index[n] = 63; | |
584 | |
585 return 0; | |
586 }else{ | |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
587 return ff_msmpeg4_decode_block(s, block, n, 1, s->inter_scantable.permutated); |
936 | 588 } |
589 } | |
590 | |
591 static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int stride, int n){ | |
592 MpegEncContext * const s= &w->s; | |
1064 | 593 |
2655
ab7bd4722cef
fix block corruption caused by clear_blocks() optimization
michael
parents:
2637
diff
changeset
|
594 if (s->block_last_index[n] >= 0) { |
936 | 595 switch(w->abt_type_table[n]){ |
596 case 0: | |
2655
ab7bd4722cef
fix block corruption caused by clear_blocks() optimization
michael
parents:
2637
diff
changeset
|
597 s->dsp.idct_add (dst, stride, block1); |
936 | 598 break; |
599 case 1: | |
600 simple_idct84_add(dst , stride, block1); | |
601 simple_idct84_add(dst + 4*stride, stride, w->abt_block2[n]); | |
602 memset(w->abt_block2[n], 0, 64*sizeof(DCTELEM)); | |
603 break; | |
604 case 2: | |
605 simple_idct48_add(dst , stride, block1); | |
606 simple_idct48_add(dst + 4 , stride, w->abt_block2[n]); | |
607 memset(w->abt_block2[n], 0, 64*sizeof(DCTELEM)); | |
608 break; | |
609 default: | |
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1524
diff
changeset
|
610 av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n"); |
936 | 611 } |
2655
ab7bd4722cef
fix block corruption caused by clear_blocks() optimization
michael
parents:
2637
diff
changeset
|
612 } |
936 | 613 } |
614 | |
615 void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block1[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr){ | |
616 Wmv2Context * const w= (Wmv2Context*)s; | |
617 | |
618 wmv2_add_block(w, block1[0], dest_y , s->linesize, 0); | |
619 wmv2_add_block(w, block1[1], dest_y + 8 , s->linesize, 1); | |
620 wmv2_add_block(w, block1[2], dest_y + 8*s->linesize, s->linesize, 2); | |
621 wmv2_add_block(w, block1[3], dest_y + 8 + 8*s->linesize, s->linesize, 3); | |
2967 | 622 |
936 | 623 if(s->flags&CODEC_FLAG_GRAY) return; |
2967 | 624 |
936 | 625 wmv2_add_block(w, block1[4], dest_cb , s->uvlinesize, 4); |
626 wmv2_add_block(w, block1[5], dest_cr , s->uvlinesize, 5); | |
627 } | |
628 | |
629 void ff_mspel_motion(MpegEncContext *s, | |
1064 | 630 uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, |
631 uint8_t **ref_picture, op_pixels_func (*pix_op)[4], | |
936 | 632 int motion_x, int motion_y, int h) |
633 { | |
634 Wmv2Context * const w= (Wmv2Context*)s; | |
1064 | 635 uint8_t *ptr; |
936 | 636 int dxy, offset, mx, my, src_x, src_y, v_edge_pos, linesize, uvlinesize; |
637 int emu=0; | |
2967 | 638 |
936 | 639 dxy = ((motion_y & 1) << 1) | (motion_x & 1); |
640 dxy = 2*dxy + w->hshift; | |
641 src_x = s->mb_x * 16 + (motion_x >> 1); | |
642 src_y = s->mb_y * 16 + (motion_y >> 1); | |
2967 | 643 |
936 | 644 /* WARNING: do no forget half pels */ |
645 v_edge_pos = s->v_edge_pos; | |
4594 | 646 src_x = av_clip(src_x, -16, s->width); |
647 src_y = av_clip(src_y, -16, s->height); | |
4333 | 648 |
649 if(src_x<=-16 || src_x >= s->width) | |
650 dxy &= ~3; | |
651 if(src_y<=-16 || src_y >= s->height) | |
652 dxy &= ~4; | |
653 | |
936 | 654 linesize = s->linesize; |
655 uvlinesize = s->uvlinesize; | |
656 ptr = ref_picture[0] + (src_y * linesize) + src_x; | |
657 | |
658 if(s->flags&CODEC_FLAG_EMU_EDGE){ | |
659 if(src_x<1 || src_y<1 || src_x + 17 >= s->h_edge_pos | |
660 || src_y + h+1 >= v_edge_pos){ | |
2967 | 661 ff_emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19, |
936 | 662 src_x-1, src_y-1, s->h_edge_pos, s->v_edge_pos); |
663 ptr= s->edge_emu_buffer + 1 + s->linesize; | |
664 emu=1; | |
665 } | |
666 } | |
667 | |
668 s->dsp.put_mspel_pixels_tab[dxy](dest_y , ptr , linesize); | |
669 s->dsp.put_mspel_pixels_tab[dxy](dest_y+8 , ptr+8 , linesize); | |
670 s->dsp.put_mspel_pixels_tab[dxy](dest_y +8*linesize, ptr +8*linesize, linesize); | |
671 s->dsp.put_mspel_pixels_tab[dxy](dest_y+8+8*linesize, ptr+8+8*linesize, linesize); | |
672 | |
673 if(s->flags&CODEC_FLAG_GRAY) return; | |
674 | |
675 if (s->out_format == FMT_H263) { | |
676 dxy = 0; | |
677 if ((motion_x & 3) != 0) | |
678 dxy |= 1; | |
679 if ((motion_y & 3) != 0) | |
680 dxy |= 2; | |
681 mx = motion_x >> 2; | |
682 my = motion_y >> 2; | |
683 } else { | |
684 mx = motion_x / 2; | |
685 my = motion_y / 2; | |
686 dxy = ((my & 1) << 1) | (mx & 1); | |
687 mx >>= 1; | |
688 my >>= 1; | |
689 } | |
2967 | 690 |
936 | 691 src_x = s->mb_x * 8 + mx; |
692 src_y = s->mb_y * 8 + my; | |
4594 | 693 src_x = av_clip(src_x, -8, s->width >> 1); |
936 | 694 if (src_x == (s->width >> 1)) |
695 dxy &= ~1; | |
4594 | 696 src_y = av_clip(src_y, -8, s->height >> 1); |
936 | 697 if (src_y == (s->height >> 1)) |
698 dxy &= ~2; | |
699 offset = (src_y * uvlinesize) + src_x; | |
700 ptr = ref_picture[1] + offset; | |
701 if(emu){ | |
2967 | 702 ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, |
936 | 703 src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); |
704 ptr= s->edge_emu_buffer; | |
705 } | |
706 pix_op[1][dxy](dest_cb, ptr, uvlinesize, h >> 1); | |
707 | |
708 ptr = ref_picture[2] + offset; | |
709 if(emu){ | |
2967 | 710 ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, |
936 | 711 src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); |
712 ptr= s->edge_emu_buffer; | |
713 } | |
714 pix_op[1][dxy](dest_cr, ptr, uvlinesize, h >> 1); | |
715 } | |
716 | |
717 | |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
718 int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) |
936 | 719 { |
720 Wmv2Context * const w= (Wmv2Context*)s; | |
721 int cbp, code, i; | |
1064 | 722 uint8_t *coded_val; |
936 | 723 |
724 if(w->j_type) return 0; | |
2967 | 725 |
936 | 726 if (s->pict_type == P_TYPE) { |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1163
diff
changeset
|
727 if(IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])){ |
936 | 728 /* skip mb */ |
729 s->mb_intra = 0; | |
730 for(i=0;i<6;i++) | |
731 s->block_last_index[i] = -1; | |
732 s->mv_dir = MV_DIR_FORWARD; | |
733 s->mv_type = MV_TYPE_16X16; | |
734 s->mv[0][0][0] = 0; | |
735 s->mv[0][0][1] = 0; | |
2628
511e3afc43e1
Ministry of English Composition, reporting for duty (and the word is "skipped", not "skiped"; "skiped" would rhyme with "hyped")
melanson
parents:
2522
diff
changeset
|
736 s->mb_skipped = 1; |
1185 | 737 w->hshift=0; |
936 | 738 return 0; |
739 } | |
740 | |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
741 code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table, MB_NON_INTRA_VLC_BITS, 3); |
936 | 742 if (code < 0) |
743 return -1; | |
2979 | 744 s->mb_intra = (~code & 0x40) >> 6; |
2967 | 745 |
936 | 746 cbp = code & 0x3f; |
747 } else { | |
748 s->mb_intra = 1; | |
2474 | 749 code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); |
936 | 750 if (code < 0){ |
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1524
diff
changeset
|
751 av_log(s->avctx, AV_LOG_ERROR, "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y); |
936 | 752 return -1; |
753 } | |
754 /* predict coded block pattern */ | |
755 cbp = 0; | |
756 for(i=0;i<6;i++) { | |
757 int val = ((code >> (5 - i)) & 1); | |
758 if (i < 4) { | |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
759 int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val); |
936 | 760 val = val ^ pred; |
761 *coded_val = val; | |
762 } | |
763 cbp |= val << (5 - i); | |
764 } | |
765 } | |
766 | |
767 if (!s->mb_intra) { | |
768 int mx, my; | |
769 //printf("P at %d %d\n", s->mb_x, s->mb_y); | |
770 wmv2_pred_motion(w, &mx, &my); | |
2967 | 771 |
936 | 772 if(cbp){ |
2632 | 773 s->dsp.clear_blocks(s->block[0]); |
936 | 774 if(s->per_mb_rl_table){ |
775 s->rl_table_index = decode012(&s->gb); | |
776 s->rl_chroma_table_index = s->rl_table_index; | |
777 } | |
778 | |
779 if(w->abt_flag && w->per_mb_abt){ | |
780 w->per_block_abt= get_bits1(&s->gb); | |
781 if(!w->per_block_abt) | |
782 w->abt_type= decode012(&s->gb); | |
783 }else | |
784 w->per_block_abt=0; | |
785 } | |
2967 | 786 |
936 | 787 if (wmv2_decode_motion(w, &mx, &my) < 0) |
788 return -1; | |
789 | |
790 s->mv_dir = MV_DIR_FORWARD; | |
791 s->mv_type = MV_TYPE_16X16; | |
792 s->mv[0][0][0] = mx; | |
793 s->mv[0][0][1] = my; | |
794 | |
795 for (i = 0; i < 6; i++) { | |
796 if (wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1) < 0) | |
2979 | 797 { |
798 av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding inter block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); | |
799 return -1; | |
800 } | |
2967 | 801 } |
936 | 802 } else { |
803 //if(s->pict_type==P_TYPE) | |
804 // printf("%d%d ", s->inter_intra_pred, cbp); | |
805 //printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24)); | |
806 s->ac_pred = get_bits1(&s->gb); | |
807 if(s->inter_intra_pred){ | |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
808 s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); |
936 | 809 // printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y); |
810 } | |
811 if(s->per_mb_rl_table && cbp){ | |
812 s->rl_table_index = decode012(&s->gb); | |
813 s->rl_chroma_table_index = s->rl_table_index; | |
814 } | |
2967 | 815 |
2632 | 816 s->dsp.clear_blocks(s->block[0]); |
936 | 817 for (i = 0; i < 6; i++) { |
5882
51fc10d9fdff
rename some msmpeg4 symbols and make them non-static
aurel
parents:
5513
diff
changeset
|
818 if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) |
2979 | 819 { |
820 av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding intra block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); | |
821 return -1; | |
822 } | |
2967 | 823 } |
936 | 824 } |
825 | |
826 return 0; | |
827 } | |
828 | |
829 static int wmv2_decode_init(AVCodecContext *avctx){ | |
830 Wmv2Context * const w= avctx->priv_data; | |
2967 | 831 |
5887 | 832 if(avctx->idct_algo==FF_IDCT_AUTO){ |
833 avctx->idct_algo=FF_IDCT_WMV2; | |
834 } | |
835 | |
936 | 836 if(ff_h263_decode_init(avctx) < 0) |
837 return -1; | |
2967 | 838 |
936 | 839 wmv2_common_init(w); |
2967 | 840 |
5887 | 841 ff_intrax8_common_init(&w->x8,&w->s); |
842 | |
936 | 843 return 0; |
844 } | |
845 | |
4947
6a4e8b52dc7b
Allow conditional compilation of H.263-related decoders.
diego
parents:
4594
diff
changeset
|
846 #ifdef CONFIG_WMV2_DECODER |
936 | 847 AVCodec wmv2_decoder = { |
848 "wmv2", | |
849 CODEC_TYPE_VIDEO, | |
850 CODEC_ID_WMV2, | |
851 sizeof(Wmv2Context), | |
852 wmv2_decode_init, | |
853 NULL, | |
854 ff_h263_decode_end, | |
855 ff_h263_decode_frame, | |
856 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | |
857 }; | |
4947
6a4e8b52dc7b
Allow conditional compilation of H.263-related decoders.
diego
parents:
4594
diff
changeset
|
858 #endif |
936 | 859 |
4950
665c61d35b52
Replace general CONFIG_ENCODERS by more fine-grained CONFIG_WMV2_ENCODER.
diego
parents:
4947
diff
changeset
|
860 #ifdef CONFIG_WMV2_ENCODER |
936 | 861 AVCodec wmv2_encoder = { |
862 "wmv2", | |
863 CODEC_TYPE_VIDEO, | |
864 CODEC_ID_WMV2, | |
865 sizeof(Wmv2Context), | |
866 wmv2_encode_init, | |
867 MPV_encode_picture, | |
868 MPV_encode_end, | |
3741 | 869 .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1}, |
936 | 870 }; |
1070
6da5ae9ee199
more #ifdef CONFIG_ENCODERS patch by (Wolfgang Hesseler <qv at multimediaware dot com>) with modifications by me (s/WOLFGANG/CONFIG_ENCODERS/ and some other fixes)
michaelni
parents:
1064
diff
changeset
|
871 #endif |