Mercurial > libavcodec.hg
comparison mpeg12.c @ 5447:26ae667e2595 libavcodec
simplify s->mv_dir init
author | michael |
---|---|
date | Thu, 02 Aug 2007 01:28:37 +0000 |
parents | 5581a40c673a |
children | a0838fadd37a |
comparison
equal
deleted
inserted
replaced
5446:9af99d2cce0f | 5447:26ae667e2595 |
---|---|
372 | 372 |
373 if (IS_QUANT(mb_type)) | 373 if (IS_QUANT(mb_type)) |
374 s->qscale = get_qscale(s); | 374 s->qscale = get_qscale(s); |
375 | 375 |
376 /* motion vectors */ | 376 /* motion vectors */ |
377 s->mv_dir = 0; | 377 s->mv_dir= (mb_type>>13)&3; |
378 dprintf(s->avctx, "motion_type=%d\n", motion_type); | 378 dprintf(s->avctx, "motion_type=%d\n", motion_type); |
379 switch(motion_type) { | 379 switch(motion_type) { |
380 case MT_FRAME: /* or MT_16X8 */ | 380 case MT_FRAME: /* or MT_16X8 */ |
381 if (s->picture_structure == PICT_FRAME) { | 381 if (s->picture_structure == PICT_FRAME) { |
382 mb_type |= MB_TYPE_16x16; | 382 mb_type |= MB_TYPE_16x16; |
383 s->mv_type = MV_TYPE_16X16; | 383 s->mv_type = MV_TYPE_16X16; |
384 for(i=0;i<2;i++) { | 384 for(i=0;i<2;i++) { |
385 if (USES_LIST(mb_type, i)) { | 385 if (USES_LIST(mb_type, i)) { |
386 s->mv_dir |= (MV_DIR_FORWARD << i); | |
387 /* MT_FRAME */ | 386 /* MT_FRAME */ |
388 s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] = | 387 s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] = |
389 mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]); | 388 mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]); |
390 s->mv[i][0][1]= s->last_mv[i][0][1]= s->last_mv[i][1][1] = | 389 s->mv[i][0][1]= s->last_mv[i][0][1]= s->last_mv[i][1][1] = |
391 mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1]); | 390 mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1]); |
399 } else { | 398 } else { |
400 mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; | 399 mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; |
401 s->mv_type = MV_TYPE_16X8; | 400 s->mv_type = MV_TYPE_16X8; |
402 for(i=0;i<2;i++) { | 401 for(i=0;i<2;i++) { |
403 if (USES_LIST(mb_type, i)) { | 402 if (USES_LIST(mb_type, i)) { |
404 s->mv_dir |= (MV_DIR_FORWARD << i); | |
405 /* MT_16X8 */ | 403 /* MT_16X8 */ |
406 for(j=0;j<2;j++) { | 404 for(j=0;j<2;j++) { |
407 s->field_select[i][j] = get_bits1(&s->gb); | 405 s->field_select[i][j] = get_bits1(&s->gb); |
408 for(k=0;k<2;k++) { | 406 for(k=0;k<2;k++) { |
409 val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], | 407 val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], |
420 s->mv_type = MV_TYPE_FIELD; | 418 s->mv_type = MV_TYPE_FIELD; |
421 if (s->picture_structure == PICT_FRAME) { | 419 if (s->picture_structure == PICT_FRAME) { |
422 mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; | 420 mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; |
423 for(i=0;i<2;i++) { | 421 for(i=0;i<2;i++) { |
424 if (USES_LIST(mb_type, i)) { | 422 if (USES_LIST(mb_type, i)) { |
425 s->mv_dir |= (MV_DIR_FORWARD << i); | |
426 for(j=0;j<2;j++) { | 423 for(j=0;j<2;j++) { |
427 s->field_select[i][j] = get_bits1(&s->gb); | 424 s->field_select[i][j] = get_bits1(&s->gb); |
428 val = mpeg_decode_motion(s, s->mpeg_f_code[i][0], | 425 val = mpeg_decode_motion(s, s->mpeg_f_code[i][0], |
429 s->last_mv[i][j][0]); | 426 s->last_mv[i][j][0]); |
430 s->last_mv[i][j][0] = val; | 427 s->last_mv[i][j][0] = val; |
440 } | 437 } |
441 } else { | 438 } else { |
442 mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; | 439 mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; |
443 for(i=0;i<2;i++) { | 440 for(i=0;i<2;i++) { |
444 if (USES_LIST(mb_type, i)) { | 441 if (USES_LIST(mb_type, i)) { |
445 s->mv_dir |= (MV_DIR_FORWARD << i); | |
446 s->field_select[i][0] = get_bits1(&s->gb); | 442 s->field_select[i][0] = get_bits1(&s->gb); |
447 for(k=0;k<2;k++) { | 443 for(k=0;k<2;k++) { |
448 val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], | 444 val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], |
449 s->last_mv[i][0][k]); | 445 s->last_mv[i][0][k]); |
450 s->last_mv[i][0][k] = val; | 446 s->last_mv[i][0][k] = val; |
458 case MT_DMV: | 454 case MT_DMV: |
459 s->mv_type = MV_TYPE_DMV; | 455 s->mv_type = MV_TYPE_DMV; |
460 for(i=0;i<2;i++) { | 456 for(i=0;i<2;i++) { |
461 if (USES_LIST(mb_type, i)) { | 457 if (USES_LIST(mb_type, i)) { |
462 int dmx, dmy, mx, my, m; | 458 int dmx, dmy, mx, my, m; |
463 s->mv_dir |= (MV_DIR_FORWARD << i); | |
464 mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0], | 459 mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0], |
465 s->last_mv[i][0][0]); | 460 s->last_mv[i][0][0]); |
466 s->last_mv[i][0][0] = mx; | 461 s->last_mv[i][0][0] = mx; |
467 s->last_mv[i][1][0] = mx; | 462 s->last_mv[i][1][0] = mx; |
468 dmx = get_dmv(s); | 463 dmx = get_dmv(s); |