Unified · Split
| @@ -400,30 +400,18 @@ static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, · 399 unmodified lines | ||
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | −static int vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha) | |
| 403 | +static av_always_inline void vp56_render_mb(VP56Context *s, int row, int col, int is_alpha, VP56mb mb_type) | |
| 404 | 404 | { |
| 405 | − AVFrame *frame_current, *frame_ref; | |
| 406 | − VP56mb mb_type; | |
| 407 | − VP56Frame ref_frame; | |
| 408 | 405 | int b, ab, b_max, plane, off; |
| 409 | − int ret; | |
| 410 | − | |
| 411 | − if (s->frames[VP56_FRAME_CURRENT]->key_frame) | |
| 412 | − mb_type = VP56_MB_INTRA; | |
| 413 | − else | |
| 414 | − mb_type = vp56_decode_mv(s, row, col); | |
| 415 | − ref_frame = ff_vp56_reference_frame[mb_type]; | |
| 416 | − | |
| 417 | − ret = s->parse_coeff(s); | |
| 418 | − if (ret < 0) | |
| 419 | − return ret; | |
| 406 | + AVFrame *frame_current, *frame_ref; | |
| 407 | + VP56Frame ref_frame = ff_vp56_reference_frame[mb_type]; | |
| 420 | 408 | |
| 421 | 409 | vp56_add_predictors_dc(s, ref_frame); |
| 422 | 410 | |
| 423 | 411 | frame_current = s->frames[VP56_FRAME_CURRENT]; |
| 424 | 412 | frame_ref = s->frames[ref_frame]; |
| 425 | 413 | if (mb_type != VP56_MB_INTRA && !frame_ref->data[0]) |
| 426 | − return 0; | |
| 414 | + return; | |
| 427 | 415 | |
| 428 | 416 | ab = 6*is_alpha; |
| 429 | 417 | b_max = 6 - 2*is_alpha; |
| @@ -473,57 +461,38 @@ static int vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha) · 43 unmodified lines | ||
| 473 | 461 | s->block_coeff[4][0] = 0; |
| 474 | 462 | s->block_coeff[5][0] = 0; |
| 475 | 463 | } |
| 476 | − return 0; | |
| 477 | 464 | } |
| 478 | 465 | |
| 479 | −static int vp56_conceal_mb(VP56Context *s, int row, int col, int is_alpha) | |
| 466 | +static int vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha) | |
| 480 | 467 | { |
| 481 | − AVFrame *frame_current, *frame_ref; | |
| 482 | 468 | VP56mb mb_type; |
| 483 | − VP56Frame ref_frame; | |
| 484 | − int b, ab, b_max, plane, off; | |
| 469 | + int ret; | |
| 485 | 470 | |
| 486 | 471 | if (s->frames[VP56_FRAME_CURRENT]->key_frame) |
| 487 | 472 | mb_type = VP56_MB_INTRA; |
| 488 | 473 | else |
| 489 | − mb_type = vp56_conceal_mv(s, row, col); | |
| 490 | − ref_frame = ff_vp56_reference_frame[mb_type]; | |
| 474 | + mb_type = vp56_decode_mv(s, row, col); | |
| 491 | 475 | |
| 492 | − frame_current = s->frames[VP56_FRAME_CURRENT]; | |
| 493 | − frame_ref = s->frames[ref_frame]; | |
| 494 | − if (mb_type != VP56_MB_INTRA && !frame_ref->data[0]) | |
| 495 | − return 0; | |
| 476 | + ret = s->parse_coeff(s); | |
| 477 | + if (ret < 0) | |
| 478 | + return ret; | |
| 496 | 479 | |
| 497 | − ab = 6*is_alpha; | |
| 498 | − b_max = 6 - 2*is_alpha; | |
| 480 | + vp56_render_mb(s, row, col, is_alpha, mb_type); | |
| 499 | 481 | |
| 500 | − switch (mb_type) { | |
| 501 | − case VP56_MB_INTRA: | |
| 502 | − for (b=0; b<b_max; b++) { | |
| 503 | − plane = ff_vp56_b2p[b+ab]; | |
| 504 | − s->vp3dsp.idct_put(frame_current->data[plane] + s->block_offset[b], | |
| 505 | − s->stride[plane], s->block_coeff[b]); | |
| 506 | − } | |
| 507 | − break; | |
| 482 | + return 0; | |
| 483 | +} | |
| 508 | 484 | |
| 509 | − case VP56_MB_INTER_NOVEC_PF: | |
| 510 | − case VP56_MB_INTER_NOVEC_GF: | |
| 511 | − for (b=0; b<b_max; b++) { | |
| 512 | − plane = ff_vp56_b2p[b+ab]; | |
| 513 | − off = s->block_offset[b]; | |
| 514 | − s->hdsp.put_pixels_tab[1][0](frame_current->data[plane] + off, | |
| 515 | − frame_ref->data[plane] + off, | |
| 516 | − s->stride[plane], 8); | |
| 517 | − s->vp3dsp.idct_add(frame_current->data[plane] + off, | |
| 518 | − s->stride[plane], s->block_coeff[b]); | |
| 519 | − } | |
| 520 | − break; | |
| 521 | − } | |
| 485 | +static int vp56_conceal_mb(VP56Context *s, int row, int col, int is_alpha) | |
| 486 | +{ | |
| 487 | + VP56mb mb_type; | |
| 488 | + | |
| 489 | + if (s->frames[VP56_FRAME_CURRENT]->key_frame) | |
| 490 | + mb_type = VP56_MB_INTRA; | |
| 491 | + else | |
| 492 | + mb_type = vp56_conceal_mv(s, row, col); | |
| 493 | + | |
| 494 | + vp56_render_mb(s, row, col, is_alpha, mb_type); | |
| 522 | 495 | |
| 523 | − if (is_alpha) { | |
| 524 | − s->block_coeff[4][0] = 0; | |
| 525 | − s->block_coeff[5][0] = 0; | |
| 526 | − } | |
| 527 | 496 | return 0; |
| 528 | 497 | } |
| 529 | 498 | |