00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00030 #include "avcodec.h"
00031 #include "dsputil.h"
00032 #include "mpegvideo.h"
00033 #include "msmpeg4.h"
00034 #include "libavutil/x86_cpu.h"
00035 #include "h263.h"
00036 #include "mpeg4video.h"
00037 #include "msmpeg4data.h"
00038 #include "vc1data.h"
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #define DC_VLC_BITS 9
00050 #define V2_INTRA_CBPC_VLC_BITS 3
00051 #define V2_MB_TYPE_VLC_BITS 7
00052 #define MV_VLC_BITS 9
00053 #define V2_MV_VLC_BITS 9
00054 #define TEX_VLC_BITS 9
00055
00056 #define DEFAULT_INTER_INDEX 3
00057
00058
00059
00060 static av_cold void init_h263_dc_for_msmpeg4(void)
00061 {
00062 int level, uni_code, uni_len;
00063
00064 for(level=-256; level<256; level++){
00065 int size, v, l;
00066
00067 size = 0;
00068 v = abs(level);
00069 while (v) {
00070 v >>= 1;
00071 size++;
00072 }
00073
00074 if (level < 0)
00075 l= (-level) ^ ((1 << size) - 1);
00076 else
00077 l= level;
00078
00079
00080 uni_code= ff_mpeg4_DCtab_lum[size][0];
00081 uni_len = ff_mpeg4_DCtab_lum[size][1];
00082 uni_code ^= (1<<uni_len)-1;
00083
00084 if (size > 0) {
00085 uni_code<<=size; uni_code|=l;
00086 uni_len+=size;
00087 if (size > 8){
00088 uni_code<<=1; uni_code|=1;
00089 uni_len++;
00090 }
00091 }
00092 ff_v2_dc_lum_table[level + 256][0] = uni_code;
00093 ff_v2_dc_lum_table[level + 256][1] = uni_len;
00094
00095
00096 uni_code= ff_mpeg4_DCtab_chrom[size][0];
00097 uni_len = ff_mpeg4_DCtab_chrom[size][1];
00098 uni_code ^= (1<<uni_len)-1;
00099
00100 if (size > 0) {
00101 uni_code<<=size; uni_code|=l;
00102 uni_len+=size;
00103 if (size > 8){
00104 uni_code<<=1; uni_code|=1;
00105 uni_len++;
00106 }
00107 }
00108 ff_v2_dc_chroma_table[level + 256][0] = uni_code;
00109 ff_v2_dc_chroma_table[level + 256][1] = uni_len;
00110
00111 }
00112 }
00113
00114 av_cold void ff_msmpeg4_common_init(MpegEncContext *s)
00115 {
00116 static int initialized=0;
00117
00118 switch(s->msmpeg4_version){
00119 case 1:
00120 case 2:
00121 s->y_dc_scale_table=
00122 s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
00123 break;
00124 case 3:
00125 if(s->workaround_bugs){
00126 s->y_dc_scale_table= ff_old_ff_y_dc_scale_table;
00127 s->c_dc_scale_table= ff_wmv1_c_dc_scale_table;
00128 } else{
00129 s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table;
00130 s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
00131 }
00132 break;
00133 case 4:
00134 case 5:
00135 s->y_dc_scale_table= ff_wmv1_y_dc_scale_table;
00136 s->c_dc_scale_table= ff_wmv1_c_dc_scale_table;
00137 break;
00138 #if CONFIG_VC1_DECODER
00139 case 6:
00140 s->y_dc_scale_table= ff_wmv3_dc_scale_table;
00141 s->c_dc_scale_table= ff_wmv3_dc_scale_table;
00142 break;
00143 #endif
00144
00145 }
00146
00147
00148 if(s->msmpeg4_version>=4){
00149 ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_wmv1_scantable[1]);
00150 ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]);
00151 ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]);
00152 ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_wmv1_scantable[0]);
00153 }
00154
00155
00156 if(!initialized){
00157 initialized=1;
00158
00159 init_h263_dc_for_msmpeg4();
00160 }
00161 }
00162
00163
00164 int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
00165 {
00166 int xy, wrap, pred, a, b, c;
00167
00168 xy = s->block_index[n];
00169 wrap = s->b8_stride;
00170
00171
00172
00173
00174 a = s->coded_block[xy - 1 ];
00175 b = s->coded_block[xy - 1 - wrap];
00176 c = s->coded_block[xy - wrap];
00177
00178 if (b == c) {
00179 pred = a;
00180 } else {
00181 pred = c;
00182 }
00183
00184
00185 *coded_block_ptr = &s->coded_block[xy];
00186
00187 return pred;
00188 }
00189
00190 static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n,
00191 int32_t **dc_val_ptr)
00192 {
00193 int i;
00194
00195 if (n < 4) {
00196 i= 0;
00197 } else {
00198 i= n-3;
00199 }
00200
00201 *dc_val_ptr= &s->last_dc[i];
00202 return s->last_dc[i];
00203 }
00204
00205 static int get_dc(uint8_t *src, int stride, int scale)
00206 {
00207 int y;
00208 int sum=0;
00209 for(y=0; y<8; y++){
00210 int x;
00211 for(x=0; x<8; x++){
00212 sum+=src[x + y*stride];
00213 }
00214 }
00215 return FASTDIV((sum + (scale>>1)), scale);
00216 }
00217
00218
00219 int ff_msmpeg4_pred_dc(MpegEncContext *s, int n,
00220 int16_t **dc_val_ptr, int *dir_ptr)
00221 {
00222 int a, b, c, wrap, pred, scale;
00223 int16_t *dc_val;
00224
00225
00226 if (n < 4) {
00227 scale = s->y_dc_scale;
00228 } else {
00229 scale = s->c_dc_scale;
00230 }
00231
00232 wrap = s->block_wrap[n];
00233 dc_val= s->dc_val[0] + s->block_index[n];
00234
00235
00236
00237
00238 a = dc_val[ - 1];
00239 b = dc_val[ - 1 - wrap];
00240 c = dc_val[ - wrap];
00241
00242 if(s->first_slice_line && (n&2)==0 && s->msmpeg4_version<4){
00243 b=c=1024;
00244 }
00245
00246
00247
00248
00249
00250 #if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE
00251 __asm__ volatile(
00252 "movl %3, %%eax \n\t"
00253 "shrl $1, %%eax \n\t"
00254 "addl %%eax, %2 \n\t"
00255 "addl %%eax, %1 \n\t"
00256 "addl %0, %%eax \n\t"
00257 "mull %4 \n\t"
00258 "movl %%edx, %0 \n\t"
00259 "movl %1, %%eax \n\t"
00260 "mull %4 \n\t"
00261 "movl %%edx, %1 \n\t"
00262 "movl %2, %%eax \n\t"
00263 "mull %4 \n\t"
00264 "movl %%edx, %2 \n\t"
00265 : "+b" (a), "+c" (b), "+D" (c)
00266 : "g" (scale), "S" (ff_inverse[scale])
00267 : "%eax", "%edx"
00268 );
00269 #else
00270
00271
00272
00273
00274 if (scale == 8) {
00275 a = (a + (8 >> 1)) / 8;
00276 b = (b + (8 >> 1)) / 8;
00277 c = (c + (8 >> 1)) / 8;
00278 } else {
00279 a = FASTDIV((a + (scale >> 1)), scale);
00280 b = FASTDIV((b + (scale >> 1)), scale);
00281 c = FASTDIV((c + (scale >> 1)), scale);
00282 }
00283 #endif
00284
00285
00286 if(s->msmpeg4_version>3){
00287 if(s->inter_intra_pred){
00288 uint8_t *dest;
00289 int wrap;
00290
00291 if(n==1){
00292 pred=a;
00293 *dir_ptr = 0;
00294 }else if(n==2){
00295 pred=c;
00296 *dir_ptr = 1;
00297 }else if(n==3){
00298 if (abs(a - b) < abs(b - c)) {
00299 pred = c;
00300 *dir_ptr = 1;
00301 } else {
00302 pred = a;
00303 *dir_ptr = 0;
00304 }
00305 }else{
00306 if(n<4){
00307 wrap= s->linesize;
00308 dest= s->current_picture.f.data[0] + (((n >> 1) + 2*s->mb_y) * 8* wrap ) + ((n & 1) + 2*s->mb_x) * 8;
00309 }else{
00310 wrap= s->uvlinesize;
00311 dest= s->current_picture.f.data[n - 3] + (s->mb_y * 8 * wrap) + s->mb_x * 8;
00312 }
00313 if(s->mb_x==0) a= (1024 + (scale>>1))/scale;
00314 else a= get_dc(dest-8, wrap, scale*8);
00315 if(s->mb_y==0) c= (1024 + (scale>>1))/scale;
00316 else c= get_dc(dest-8*wrap, wrap, scale*8);
00317
00318 if (s->h263_aic_dir==0) {
00319 pred= a;
00320 *dir_ptr = 0;
00321 }else if (s->h263_aic_dir==1) {
00322 if(n==0){
00323 pred= c;
00324 *dir_ptr = 1;
00325 }else{
00326 pred= a;
00327 *dir_ptr = 0;
00328 }
00329 }else if (s->h263_aic_dir==2) {
00330 if(n==0){
00331 pred= a;
00332 *dir_ptr = 0;
00333 }else{
00334 pred= c;
00335 *dir_ptr = 1;
00336 }
00337 } else {
00338 pred= c;
00339 *dir_ptr = 1;
00340 }
00341 }
00342 }else{
00343 if (abs(a - b) < abs(b - c)) {
00344 pred = c;
00345 *dir_ptr = 1;
00346 } else {
00347 pred = a;
00348 *dir_ptr = 0;
00349 }
00350 }
00351 }else{
00352 if (abs(a - b) <= abs(b - c)) {
00353 pred = c;
00354 *dir_ptr = 1;
00355 } else {
00356 pred = a;
00357 *dir_ptr = 0;
00358 }
00359 }
00360
00361
00362 *dc_val_ptr = &dc_val[0];
00363 return pred;
00364 }
00365
00366
00367
00368
00369 VLC ff_mb_non_intra_vlc[4];
00370 static VLC v2_dc_lum_vlc;
00371 static VLC v2_dc_chroma_vlc;
00372 static VLC v2_intra_cbpc_vlc;
00373 static VLC v2_mb_type_vlc;
00374 static VLC v2_mv_vlc;
00375 VLC ff_inter_intra_vlc;
00376
00377
00378 static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
00379 {
00380 int code, val, sign, shift;
00381
00382 code = get_vlc2(&s->gb, v2_mv_vlc.table, V2_MV_VLC_BITS, 2);
00383
00384 if (code < 0)
00385 return 0xffff;
00386
00387 if (code == 0)
00388 return pred;
00389 sign = get_bits1(&s->gb);
00390 shift = f_code - 1;
00391 val = code;
00392 if (shift) {
00393 val = (val - 1) << shift;
00394 val |= get_bits(&s->gb, shift);
00395 val++;
00396 }
00397 if (sign)
00398 val = -val;
00399
00400 val += pred;
00401 if (val <= -64)
00402 val += 64;
00403 else if (val >= 64)
00404 val -= 64;
00405
00406 return val;
00407 }
00408
00409 static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
00410 {
00411 int cbp, code, i;
00412
00413 if (s->pict_type == AV_PICTURE_TYPE_P) {
00414 if (s->use_skip_mb_code) {
00415 if (get_bits1(&s->gb)) {
00416
00417 s->mb_intra = 0;
00418 for(i=0;i<6;i++)
00419 s->block_last_index[i] = -1;
00420 s->mv_dir = MV_DIR_FORWARD;
00421 s->mv_type = MV_TYPE_16X16;
00422 s->mv[0][0][0] = 0;
00423 s->mv[0][0][1] = 0;
00424 s->mb_skipped = 1;
00425 return 0;
00426 }
00427 }
00428
00429 if(s->msmpeg4_version==2)
00430 code = get_vlc2(&s->gb, v2_mb_type_vlc.table, V2_MB_TYPE_VLC_BITS, 1);
00431 else
00432 code = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
00433 if(code<0 || code>7){
00434 av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y);
00435 return -1;
00436 }
00437
00438 s->mb_intra = code >>2;
00439
00440 cbp = code & 0x3;
00441 } else {
00442 s->mb_intra = 1;
00443 if(s->msmpeg4_version==2)
00444 cbp= get_vlc2(&s->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1);
00445 else
00446 cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1);
00447 if(cbp<0 || cbp>3){
00448 av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
00449 return -1;
00450 }
00451 }
00452
00453 if (!s->mb_intra) {
00454 int mx, my, cbpy;
00455
00456 cbpy= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
00457 if(cbpy<0){
00458 av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
00459 return -1;
00460 }
00461
00462 cbp|= cbpy<<2;
00463 if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C;
00464
00465 ff_h263_pred_motion(s, 0, 0, &mx, &my);
00466 mx= msmpeg4v2_decode_motion(s, mx, 1);
00467 my= msmpeg4v2_decode_motion(s, my, 1);
00468
00469 s->mv_dir = MV_DIR_FORWARD;
00470 s->mv_type = MV_TYPE_16X16;
00471 s->mv[0][0][0] = mx;
00472 s->mv[0][0][1] = my;
00473 } else {
00474 if(s->msmpeg4_version==2){
00475 s->ac_pred = get_bits1(&s->gb);
00476 cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2;
00477 } else{
00478 s->ac_pred = 0;
00479 cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2;
00480 if(s->pict_type==AV_PICTURE_TYPE_P) cbp^=0x3C;
00481 }
00482 }
00483
00484 s->dsp.clear_blocks(s->block[0]);
00485 for (i = 0; i < 6; i++) {
00486 if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
00487 {
00488 av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
00489 return -1;
00490 }
00491 }
00492 return 0;
00493 }
00494
00495 static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
00496 {
00497 int cbp, code, i;
00498 uint8_t *coded_val;
00499 uint32_t * const mb_type_ptr = &s->current_picture.f.mb_type[s->mb_x + s->mb_y*s->mb_stride];
00500
00501 if (s->pict_type == AV_PICTURE_TYPE_P) {
00502 if (s->use_skip_mb_code) {
00503 if (get_bits1(&s->gb)) {
00504
00505 s->mb_intra = 0;
00506 for(i=0;i<6;i++)
00507 s->block_last_index[i] = -1;
00508 s->mv_dir = MV_DIR_FORWARD;
00509 s->mv_type = MV_TYPE_16X16;
00510 s->mv[0][0][0] = 0;
00511 s->mv[0][0][1] = 0;
00512 s->mb_skipped = 1;
00513 *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
00514
00515 return 0;
00516 }
00517 }
00518
00519 code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[DEFAULT_INTER_INDEX].table, MB_NON_INTRA_VLC_BITS, 3);
00520 if (code < 0)
00521 return -1;
00522
00523 s->mb_intra = (~code & 0x40) >> 6;
00524
00525 cbp = code & 0x3f;
00526 } else {
00527 s->mb_intra = 1;
00528 code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
00529 if (code < 0)
00530 return -1;
00531
00532 cbp = 0;
00533 for(i=0;i<6;i++) {
00534 int val = ((code >> (5 - i)) & 1);
00535 if (i < 4) {
00536 int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
00537 val = val ^ pred;
00538 *coded_val = val;
00539 }
00540 cbp |= val << (5 - i);
00541 }
00542 }
00543
00544 if (!s->mb_intra) {
00545 int mx, my;
00546
00547 if(s->per_mb_rl_table && cbp){
00548 s->rl_table_index = decode012(&s->gb);
00549 s->rl_chroma_table_index = s->rl_table_index;
00550 }
00551 ff_h263_pred_motion(s, 0, 0, &mx, &my);
00552 if (ff_msmpeg4_decode_motion(s, &mx, &my) < 0)
00553 return -1;
00554 s->mv_dir = MV_DIR_FORWARD;
00555 s->mv_type = MV_TYPE_16X16;
00556 s->mv[0][0][0] = mx;
00557 s->mv[0][0][1] = my;
00558 *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;
00559 } else {
00560
00561 s->ac_pred = get_bits1(&s->gb);
00562 *mb_type_ptr = MB_TYPE_INTRA;
00563 if(s->inter_intra_pred){
00564 s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
00565
00566 }
00567 if(s->per_mb_rl_table && cbp){
00568 s->rl_table_index = decode012(&s->gb);
00569 s->rl_chroma_table_index = s->rl_table_index;
00570 }
00571 }
00572
00573 s->dsp.clear_blocks(s->block[0]);
00574 for (i = 0; i < 6; i++) {
00575 if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
00576 {
00577 av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
00578 return -1;
00579 }
00580 }
00581
00582 return 0;
00583 }
00584
00585
00586 av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
00587 {
00588 MpegEncContext *s = avctx->priv_data;
00589 static int done = 0;
00590 int i;
00591 MVTable *mv;
00592
00593 if (ff_h263_decode_init(avctx) < 0)
00594 return -1;
00595
00596 ff_msmpeg4_common_init(s);
00597
00598 if (!done) {
00599 done = 1;
00600
00601 for(i=0;i<NB_RL_TABLES;i++) {
00602 ff_init_rl(&ff_rl_table[i], ff_static_rl_table_store[i]);
00603 }
00604 INIT_VLC_RL(ff_rl_table[0], 642);
00605 INIT_VLC_RL(ff_rl_table[1], 1104);
00606 INIT_VLC_RL(ff_rl_table[2], 554);
00607 INIT_VLC_RL(ff_rl_table[3], 940);
00608 INIT_VLC_RL(ff_rl_table[4], 962);
00609 INIT_VLC_RL(ff_rl_table[5], 554);
00610
00611 mv = &ff_mv_tables[0];
00612 INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, mv->n + 1,
00613 mv->table_mv_bits, 1, 1,
00614 mv->table_mv_code, 2, 2, 3714);
00615 mv = &ff_mv_tables[1];
00616 INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, mv->n + 1,
00617 mv->table_mv_bits, 1, 1,
00618 mv->table_mv_code, 2, 2, 2694);
00619
00620 INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[0], DC_VLC_BITS, 120,
00621 &ff_table0_dc_lum[0][1], 8, 4,
00622 &ff_table0_dc_lum[0][0], 8, 4, 1158);
00623 INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[0], DC_VLC_BITS, 120,
00624 &ff_table0_dc_chroma[0][1], 8, 4,
00625 &ff_table0_dc_chroma[0][0], 8, 4, 1118);
00626 INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[1], DC_VLC_BITS, 120,
00627 &ff_table1_dc_lum[0][1], 8, 4,
00628 &ff_table1_dc_lum[0][0], 8, 4, 1476);
00629 INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[1], DC_VLC_BITS, 120,
00630 &ff_table1_dc_chroma[0][1], 8, 4,
00631 &ff_table1_dc_chroma[0][0], 8, 4, 1216);
00632
00633 INIT_VLC_STATIC(&v2_dc_lum_vlc, DC_VLC_BITS, 512,
00634 &ff_v2_dc_lum_table[0][1], 8, 4,
00635 &ff_v2_dc_lum_table[0][0], 8, 4, 1472);
00636 INIT_VLC_STATIC(&v2_dc_chroma_vlc, DC_VLC_BITS, 512,
00637 &ff_v2_dc_chroma_table[0][1], 8, 4,
00638 &ff_v2_dc_chroma_table[0][0], 8, 4, 1506);
00639
00640 INIT_VLC_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4,
00641 &ff_v2_intra_cbpc[0][1], 2, 1,
00642 &ff_v2_intra_cbpc[0][0], 2, 1, 8);
00643 INIT_VLC_STATIC(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8,
00644 &ff_v2_mb_type[0][1], 2, 1,
00645 &ff_v2_mb_type[0][0], 2, 1, 128);
00646 INIT_VLC_STATIC(&v2_mv_vlc, V2_MV_VLC_BITS, 33,
00647 &ff_mvtab[0][1], 2, 1,
00648 &ff_mvtab[0][0], 2, 1, 538);
00649
00650 INIT_VLC_STATIC(&ff_mb_non_intra_vlc[0], MB_NON_INTRA_VLC_BITS, 128,
00651 &ff_wmv2_inter_table[0][0][1], 8, 4,
00652 &ff_wmv2_inter_table[0][0][0], 8, 4, 1636);
00653 INIT_VLC_STATIC(&ff_mb_non_intra_vlc[1], MB_NON_INTRA_VLC_BITS, 128,
00654 &ff_wmv2_inter_table[1][0][1], 8, 4,
00655 &ff_wmv2_inter_table[1][0][0], 8, 4, 2648);
00656 INIT_VLC_STATIC(&ff_mb_non_intra_vlc[2], MB_NON_INTRA_VLC_BITS, 128,
00657 &ff_wmv2_inter_table[2][0][1], 8, 4,
00658 &ff_wmv2_inter_table[2][0][0], 8, 4, 1532);
00659 INIT_VLC_STATIC(&ff_mb_non_intra_vlc[3], MB_NON_INTRA_VLC_BITS, 128,
00660 &ff_wmv2_inter_table[3][0][1], 8, 4,
00661 &ff_wmv2_inter_table[3][0][0], 8, 4, 2488);
00662
00663 INIT_VLC_STATIC(&ff_msmp4_mb_i_vlc, MB_INTRA_VLC_BITS, 64,
00664 &ff_msmp4_mb_i_table[0][1], 4, 2,
00665 &ff_msmp4_mb_i_table[0][0], 4, 2, 536);
00666
00667 INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4,
00668 &ff_table_inter_intra[0][1], 2, 1,
00669 &ff_table_inter_intra[0][0], 2, 1, 8);
00670 }
00671
00672 switch(s->msmpeg4_version){
00673 case 1:
00674 case 2:
00675 s->decode_mb= msmpeg4v12_decode_mb;
00676 break;
00677 case 3:
00678 case 4:
00679 s->decode_mb= msmpeg4v34_decode_mb;
00680 break;
00681 case 5:
00682 if (CONFIG_WMV2_DECODER)
00683 s->decode_mb= ff_wmv2_decode_mb;
00684 case 6:
00685
00686 break;
00687 }
00688
00689 s->slice_height= s->mb_height;
00690
00691 return 0;
00692 }
00693
00694 int ff_msmpeg4_decode_picture_header(MpegEncContext * s)
00695 {
00696 int code;
00697
00698 if(s->msmpeg4_version==1){
00699 int start_code = get_bits_long(&s->gb, 32);
00700 if(start_code!=0x00000100){
00701 av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n");
00702 return -1;
00703 }
00704
00705 skip_bits(&s->gb, 5);
00706 }
00707
00708 s->pict_type = get_bits(&s->gb, 2) + 1;
00709 if (s->pict_type != AV_PICTURE_TYPE_I &&
00710 s->pict_type != AV_PICTURE_TYPE_P){
00711 av_log(s->avctx, AV_LOG_ERROR, "invalid picture type\n");
00712 return -1;
00713 }
00714 #if 0
00715 {
00716 static int had_i=0;
00717 if(s->pict_type == AV_PICTURE_TYPE_I) had_i=1;
00718 if(!had_i) return -1;
00719 }
00720 #endif
00721 s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
00722 if(s->qscale==0){
00723 av_log(s->avctx, AV_LOG_ERROR, "invalid qscale\n");
00724 return -1;
00725 }
00726
00727 if (s->pict_type == AV_PICTURE_TYPE_I) {
00728 code = get_bits(&s->gb, 5);
00729 if(s->msmpeg4_version==1){
00730 if(code==0 || code>s->mb_height){
00731 av_log(s->avctx, AV_LOG_ERROR, "invalid slice height %d\n", code);
00732 return -1;
00733 }
00734
00735 s->slice_height = code;
00736 }else{
00737
00738 if (code < 0x17){
00739 av_log(s->avctx, AV_LOG_ERROR, "error, slice code was %X\n", code);
00740 return -1;
00741 }
00742
00743 s->slice_height = s->mb_height / (code - 0x16);
00744 }
00745
00746 switch(s->msmpeg4_version){
00747 case 1:
00748 case 2:
00749 s->rl_chroma_table_index = 2;
00750 s->rl_table_index = 2;
00751
00752 s->dc_table_index = 0;
00753 break;
00754 case 3:
00755 s->rl_chroma_table_index = decode012(&s->gb);
00756 s->rl_table_index = decode012(&s->gb);
00757
00758 s->dc_table_index = get_bits1(&s->gb);
00759 break;
00760 case 4:
00761 ff_msmpeg4_decode_ext_header(s, (2+5+5+17+7)/8);
00762
00763 if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb);
00764 else s->per_mb_rl_table= 0;
00765
00766 if(!s->per_mb_rl_table){
00767 s->rl_chroma_table_index = decode012(&s->gb);
00768 s->rl_table_index = decode012(&s->gb);
00769 }
00770
00771 s->dc_table_index = get_bits1(&s->gb);
00772 s->inter_intra_pred= 0;
00773 break;
00774 }
00775 s->no_rounding = 1;
00776 if(s->avctx->debug&FF_DEBUG_PICT_INFO)
00777 av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d \n",
00778 s->qscale,
00779 s->rl_chroma_table_index,
00780 s->rl_table_index,
00781 s->dc_table_index,
00782 s->per_mb_rl_table,
00783 s->slice_height);
00784 } else {
00785 switch(s->msmpeg4_version){
00786 case 1:
00787 case 2:
00788 if(s->msmpeg4_version==1)
00789 s->use_skip_mb_code = 1;
00790 else
00791 s->use_skip_mb_code = get_bits1(&s->gb);
00792 s->rl_table_index = 2;
00793 s->rl_chroma_table_index = s->rl_table_index;
00794 s->dc_table_index = 0;
00795 s->mv_table_index = 0;
00796 break;
00797 case 3:
00798 s->use_skip_mb_code = get_bits1(&s->gb);
00799 s->rl_table_index = decode012(&s->gb);
00800 s->rl_chroma_table_index = s->rl_table_index;
00801
00802 s->dc_table_index = get_bits1(&s->gb);
00803
00804 s->mv_table_index = get_bits1(&s->gb);
00805 break;
00806 case 4:
00807 s->use_skip_mb_code = get_bits1(&s->gb);
00808
00809 if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb);
00810 else s->per_mb_rl_table= 0;
00811
00812 if(!s->per_mb_rl_table){
00813 s->rl_table_index = decode012(&s->gb);
00814 s->rl_chroma_table_index = s->rl_table_index;
00815 }
00816
00817 s->dc_table_index = get_bits1(&s->gb);
00818
00819 s->mv_table_index = get_bits1(&s->gb);
00820 s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
00821 break;
00822 }
00823
00824 if(s->avctx->debug&FF_DEBUG_PICT_INFO)
00825 av_log(s->avctx, AV_LOG_DEBUG, "skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d \n",
00826 s->use_skip_mb_code,
00827 s->rl_table_index,
00828 s->rl_chroma_table_index,
00829 s->dc_table_index,
00830 s->mv_table_index,
00831 s->per_mb_rl_table,
00832 s->qscale);
00833
00834 if(s->flipflop_rounding){
00835 s->no_rounding ^= 1;
00836 }else{
00837 s->no_rounding = 0;
00838 }
00839 }
00840
00841
00842 s->esc3_level_length= 0;
00843 s->esc3_run_length= 0;
00844
00845 return 0;
00846 }
00847
00848 int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
00849 {
00850 int left= buf_size*8 - get_bits_count(&s->gb);
00851 int length= s->msmpeg4_version>=3 ? 17 : 16;
00852
00853 if(left>=length && left<length+8)
00854 {
00855 skip_bits(&s->gb, 5);
00856 s->bit_rate= get_bits(&s->gb, 11)*1024;
00857 if(s->msmpeg4_version>=3)
00858 s->flipflop_rounding= get_bits1(&s->gb);
00859 else
00860 s->flipflop_rounding= 0;
00861
00862
00863 }
00864 else if(left<length+8)
00865 {
00866 s->flipflop_rounding= 0;
00867 if(s->msmpeg4_version != 2)
00868 av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left);
00869 }
00870 else
00871 {
00872 av_log(s->avctx, AV_LOG_ERROR, "I frame too long, ignoring ext header\n");
00873 }
00874
00875 return 0;
00876 }
00877
00878 static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
00879 {
00880 int level, pred;
00881
00882 if(s->msmpeg4_version<=2){
00883 if (n < 4) {
00884 level = get_vlc2(&s->gb, v2_dc_lum_vlc.table, DC_VLC_BITS, 3);
00885 } else {
00886 level = get_vlc2(&s->gb, v2_dc_chroma_vlc.table, DC_VLC_BITS, 3);
00887 }
00888 if (level < 0)
00889 return -1;
00890 level-=256;
00891 }else{
00892 if (n < 4) {
00893 level = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
00894 } else {
00895 level = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
00896 }
00897 if (level < 0){
00898 av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
00899 return -1;
00900 }
00901
00902 if (level == DC_MAX) {
00903 level = get_bits(&s->gb, 8);
00904 if (get_bits1(&s->gb))
00905 level = -level;
00906 } else if (level != 0) {
00907 if (get_bits1(&s->gb))
00908 level = -level;
00909 }
00910 }
00911
00912 if(s->msmpeg4_version==1){
00913 int32_t *dc_val;
00914 pred = msmpeg4v1_pred_dc(s, n, &dc_val);
00915 level += pred;
00916
00917
00918 *dc_val= level;
00919 }else{
00920 int16_t *dc_val;
00921 pred = ff_msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
00922 level += pred;
00923
00924
00925 if (n < 4) {
00926 *dc_val = level * s->y_dc_scale;
00927 } else {
00928 *dc_val = level * s->c_dc_scale;
00929 }
00930 }
00931
00932 return level;
00933 }
00934
00935
00936 int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
00937 int n, int coded, const uint8_t *scan_table)
00938 {
00939 int level, i, last, run, run_diff;
00940 int av_uninit(dc_pred_dir);
00941 RLTable *rl;
00942 RL_VLC_ELEM *rl_vlc;
00943 int qmul, qadd;
00944
00945 if (s->mb_intra) {
00946 qmul=1;
00947 qadd=0;
00948
00949
00950 level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
00951
00952 if (level < 0){
00953 av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
00954 if(s->inter_intra_pred) level=0;
00955 else return -1;
00956 }
00957 if (n < 4) {
00958 rl = &ff_rl_table[s->rl_table_index];
00959 if(level > 256*s->y_dc_scale){
00960 av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d//\n", s->qscale);
00961 if(!s->inter_intra_pred) return -1;
00962 }
00963 } else {
00964 rl = &ff_rl_table[3 + s->rl_chroma_table_index];
00965 if(level > 256*s->c_dc_scale){
00966 av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d//\n", s->qscale);
00967 if(!s->inter_intra_pred) return -1;
00968 }
00969 }
00970 block[0] = level;
00971
00972 run_diff = s->msmpeg4_version >= 4;
00973 i = 0;
00974 if (!coded) {
00975 goto not_coded;
00976 }
00977 if (s->ac_pred) {
00978 if (dc_pred_dir == 0)
00979 scan_table = s->intra_v_scantable.permutated;
00980 else
00981 scan_table = s->intra_h_scantable.permutated;
00982 } else {
00983 scan_table = s->intra_scantable.permutated;
00984 }
00985 rl_vlc= rl->rl_vlc[0];
00986 } else {
00987 qmul = s->qscale << 1;
00988 qadd = (s->qscale - 1) | 1;
00989 i = -1;
00990 rl = &ff_rl_table[3 + s->rl_table_index];
00991
00992 if(s->msmpeg4_version==2)
00993 run_diff = 0;
00994 else
00995 run_diff = 1;
00996
00997 if (!coded) {
00998 s->block_last_index[n] = i;
00999 return 0;
01000 }
01001 if(!scan_table)
01002 scan_table = s->inter_scantable.permutated;
01003 rl_vlc= rl->rl_vlc[s->qscale];
01004 }
01005 {
01006 OPEN_READER(re, &s->gb);
01007 for(;;) {
01008 UPDATE_CACHE(re, &s->gb);
01009 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
01010 if (level==0) {
01011 int cache;
01012 cache= GET_CACHE(re, &s->gb);
01013
01014 if (s->msmpeg4_version==1 || (cache&0x80000000)==0) {
01015 if (s->msmpeg4_version==1 || (cache&0x40000000)==0) {
01016
01017 if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2);
01018 UPDATE_CACHE(re, &s->gb);
01019 if(s->msmpeg4_version<=3){
01020 last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
01021 run= SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
01022 level= SHOW_SBITS(re, &s->gb, 8);
01023 SKIP_COUNTER(re, &s->gb, 1+6+8);
01024 }else{
01025 int sign;
01026 last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
01027 if(!s->esc3_level_length){
01028 int ll;
01029
01030 if(s->qscale<8){
01031 ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
01032 if(ll==0){
01033 ll= 8+SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
01034 }
01035 }else{
01036 ll=2;
01037 while(ll<8 && SHOW_UBITS(re, &s->gb, 1)==0){
01038 ll++;
01039 SKIP_BITS(re, &s->gb, 1);
01040 }
01041 if(ll<8) SKIP_BITS(re, &s->gb, 1);
01042 }
01043
01044 s->esc3_level_length= ll;
01045 s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
01046
01047 UPDATE_CACHE(re, &s->gb);
01048 }
01049 run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
01050 SKIP_BITS(re, &s->gb, s->esc3_run_length);
01051
01052 sign= SHOW_UBITS(re, &s->gb, 1);
01053 SKIP_BITS(re, &s->gb, 1);
01054
01055 level= SHOW_UBITS(re, &s->gb, s->esc3_level_length);
01056 SKIP_BITS(re, &s->gb, s->esc3_level_length);
01057 if(sign) level= -level;
01058 }
01059
01060 #if 0 // waste of time / this will detect very few errors
01061 {
01062 const int abs_level= FFABS(level);
01063 const int run1= run - rl->max_run[last][abs_level] - run_diff;
01064 if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
01065 if(abs_level <= rl->max_level[last][run]){
01066 av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
01067 return DECODING_AC_LOST;
01068 }
01069 if(abs_level <= rl->max_level[last][run]*2){
01070 av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
01071 return DECODING_AC_LOST;
01072 }
01073 if(run1>=0 && abs_level <= rl->max_level[last][run1]){
01074 av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
01075 return DECODING_AC_LOST;
01076 }
01077 }
01078 }
01079 #endif
01080
01081 if (level>0) level= level * qmul + qadd;
01082 else level= level * qmul - qadd;
01083 #if 0 // waste of time too :(
01084 if(level>2048 || level<-2048){
01085 av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n");
01086 return DECODING_AC_LOST;
01087 }
01088 #endif
01089 i+= run + 1;
01090 if(last) i+=192;
01091 #ifdef ERROR_DETAILS
01092 if(run==66)
01093 av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
01094 else if((i>62 && i<192) || i>192+63)
01095 av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
01096 #endif
01097 } else {
01098
01099 SKIP_BITS(re, &s->gb, 2);
01100 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
01101 i+= run + rl->max_run[run>>7][level/qmul] + run_diff;
01102 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
01103 LAST_SKIP_BITS(re, &s->gb, 1);
01104 #ifdef ERROR_DETAILS
01105 if(run==66)
01106 av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
01107 else if((i>62 && i<192) || i>192+63)
01108 av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
01109 #endif
01110 }
01111 } else {
01112
01113 SKIP_BITS(re, &s->gb, 1);
01114 GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
01115 i+= run;
01116 level = level + rl->max_level[run>>7][(run-1)&63] * qmul;
01117 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
01118 LAST_SKIP_BITS(re, &s->gb, 1);
01119 #ifdef ERROR_DETAILS
01120 if(run==66)
01121 av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
01122 else if((i>62 && i<192) || i>192+63)
01123 av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
01124 #endif
01125 }
01126 } else {
01127 i+= run;
01128 level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
01129 LAST_SKIP_BITS(re, &s->gb, 1);
01130 #ifdef ERROR_DETAILS
01131 if(run==66)
01132 av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level);
01133 else if((i>62 && i<192) || i>192+63)
01134 av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level);
01135 #endif
01136 }
01137 if (i > 62){
01138 i-= 192;
01139 if(i&(~63)){
01140 const int left= get_bits_left(&s->gb);
01141 if(((i+192 == 64 && level/qmul==-1) || !(s->err_recognition&(AV_EF_BITSTREAM|AV_EF_COMPLIANT))) && left>=0){
01142 av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
01143 break;
01144 }else{
01145 av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
01146 return -1;
01147 }
01148 }
01149
01150 block[scan_table[i]] = level;
01151 break;
01152 }
01153
01154 block[scan_table[i]] = level;
01155 }
01156 CLOSE_READER(re, &s->gb);
01157 }
01158 not_coded:
01159 if (s->mb_intra) {
01160 ff_mpeg4_pred_ac(s, block, n, dc_pred_dir);
01161 if (s->ac_pred) {
01162 i = 63;
01163 }
01164 }
01165 if(s->msmpeg4_version>=4 && i>0) i=63;
01166 s->block_last_index[n] = i;
01167
01168 return 0;
01169 }
01170
01171 int ff_msmpeg4_decode_motion(MpegEncContext * s,
01172 int *mx_ptr, int *my_ptr)
01173 {
01174 MVTable *mv;
01175 int code, mx, my;
01176
01177 mv = &ff_mv_tables[s->mv_table_index];
01178
01179 code = get_vlc2(&s->gb, mv->vlc.table, MV_VLC_BITS, 2);
01180 if (code < 0){
01181 av_log(s->avctx, AV_LOG_ERROR, "illegal MV code at %d %d\n", s->mb_x, s->mb_y);
01182 return -1;
01183 }
01184 if (code == mv->n) {
01185
01186 mx = get_bits(&s->gb, 6);
01187 my = get_bits(&s->gb, 6);
01188 } else {
01189 mx = mv->table_mvx[code];
01190 my = mv->table_mvy[code];
01191 }
01192
01193 mx += *mx_ptr - 32;
01194 my += *my_ptr - 32;
01195
01196 if (mx <= -64)
01197 mx += 64;
01198 else if (mx >= 64)
01199 mx -= 64;
01200
01201 if (my <= -64)
01202 my += 64;
01203 else if (my >= 64)
01204 my -= 64;
01205 *mx_ptr = mx;
01206 *my_ptr = my;
01207 return 0;
01208 }
01209
01210 AVCodec ff_msmpeg4v1_decoder = {
01211 .name = "msmpeg4v1",
01212 .type = AVMEDIA_TYPE_VIDEO,
01213 .id = CODEC_ID_MSMPEG4V1,
01214 .priv_data_size = sizeof(MpegEncContext),
01215 .init = ff_msmpeg4_decode_init,
01216 .close = ff_h263_decode_end,
01217 .decode = ff_h263_decode_frame,
01218 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
01219 .max_lowres = 3,
01220 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
01221 .pix_fmts = ff_pixfmt_list_420,
01222 };
01223
01224 AVCodec ff_msmpeg4v2_decoder = {
01225 .name = "msmpeg4v2",
01226 .type = AVMEDIA_TYPE_VIDEO,
01227 .id = CODEC_ID_MSMPEG4V2,
01228 .priv_data_size = sizeof(MpegEncContext),
01229 .init = ff_msmpeg4_decode_init,
01230 .close = ff_h263_decode_end,
01231 .decode = ff_h263_decode_frame,
01232 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
01233 .max_lowres = 3,
01234 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
01235 .pix_fmts = ff_pixfmt_list_420,
01236 };
01237
01238 AVCodec ff_msmpeg4v3_decoder = {
01239 .name = "msmpeg4",
01240 .type = AVMEDIA_TYPE_VIDEO,
01241 .id = CODEC_ID_MSMPEG4V3,
01242 .priv_data_size = sizeof(MpegEncContext),
01243 .init = ff_msmpeg4_decode_init,
01244 .close = ff_h263_decode_end,
01245 .decode = ff_h263_decode_frame,
01246 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
01247 .max_lowres = 3,
01248 .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
01249 .pix_fmts = ff_pixfmt_list_420,
01250 };
01251
01252 AVCodec ff_wmv1_decoder = {
01253 .name = "wmv1",
01254 .type = AVMEDIA_TYPE_VIDEO,
01255 .id = CODEC_ID_WMV1,
01256 .priv_data_size = sizeof(MpegEncContext),
01257 .init = ff_msmpeg4_decode_init,
01258 .close = ff_h263_decode_end,
01259 .decode = ff_h263_decode_frame,
01260 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
01261 .max_lowres = 3,
01262 .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
01263 .pix_fmts = ff_pixfmt_list_420,
01264 };