History

avcodec/vp56: Factorize vp56_render_mb() out

Michael Niedermayer committed 9 years ago

Commit 4c013941 parent 949d2171 file · +23 −54Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vp56.c+23−54
@@ -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
403static int vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)403static 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 int b, ab, b_max, plane, off;405 int b, ab, b_max, plane, off;
409 int ret;406 AVFrame *frame_current, *frame_ref;
410 407 VP56Frame ref_frame = ff_vp56_reference_frame[mb_type];
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;
420 408
421 vp56_add_predictors_dc(s, ref_frame);409 vp56_add_predictors_dc(s, ref_frame);
422 410
423 frame_current = s->frames[VP56_FRAME_CURRENT];411 frame_current = s->frames[VP56_FRAME_CURRENT];
424 frame_ref = s->frames[ref_frame];412 frame_ref = s->frames[ref_frame];
425 if (mb_type != VP56_MB_INTRA && !frame_ref->data[0])413 if (mb_type != VP56_MB_INTRA && !frame_ref->data[0])
426 return 0;414 return;
427 415
428 ab = 6*is_alpha;416 ab = 6*is_alpha;
429 b_max = 6 - 2*is_alpha;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 s->block_coeff[4][0] = 0;461 s->block_coeff[4][0] = 0;
474 s->block_coeff[5][0] = 0;462 s->block_coeff[5][0] = 0;
475 }463 }
476 return 0;
477}464}
478 465
479static int vp56_conceal_mb(VP56Context *s, int row, int col, int is_alpha)466static int vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)
480{467{
481 AVFrame *frame_current, *frame_ref;
482 VP56mb mb_type;468 VP56mb mb_type;
483 VP56Frame ref_frame;469 int ret;
484 int b, ab, b_max, plane, off;
485 470
486 if (s->frames[VP56_FRAME_CURRENT]->key_frame)471 if (s->frames[VP56_FRAME_CURRENT]->key_frame)
487 mb_type = VP56_MB_INTRA;472 mb_type = VP56_MB_INTRA;
488 else473 else
489 mb_type = vp56_conceal_mv(s, row, col);474 mb_type = vp56_decode_mv(s, row, col);
490 ref_frame = ff_vp56_reference_frame[mb_type];
491 475
492 frame_current = s->frames[VP56_FRAME_CURRENT];476 ret = s->parse_coeff(s);
493 frame_ref = s->frames[ref_frame];477 if (ret < 0)
494 if (mb_type != VP56_MB_INTRA && !frame_ref->data[0])478 return ret;
495 return 0;
496 479
497 ab = 6*is_alpha;480 vp56_render_mb(s, row, col, is_alpha, mb_type);
498 b_max = 6 - 2*is_alpha;
499 481
500 switch (mb_type) {482 return 0;
501 case VP56_MB_INTRA:483}
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;
508 484
509 case VP56_MB_INTER_NOVEC_PF:485static int vp56_conceal_mb(VP56Context *s, int row, int col, int is_alpha)
510 case VP56_MB_INTER_NOVEC_GF:486{
511 for (b=0; b<b_max; b++) {487 VP56mb mb_type;
512 plane = ff_vp56_b2p[b+ab];488
513 off = s->block_offset[b];489 if (s->frames[VP56_FRAME_CURRENT]->key_frame)
514 s->hdsp.put_pixels_tab[1][0](frame_current->data[plane] + off,490 mb_type = VP56_MB_INTRA;
515 frame_ref->data[plane] + off,491 else
516 s->stride[plane], 8);492 mb_type = vp56_conceal_mv(s, row, col);
517 s->vp3dsp.idct_add(frame_current->data[plane] + off,493
518 s->stride[plane], s->block_coeff[b]);494 vp56_render_mb(s, row, col, is_alpha, mb_type);
519 }
520 break;
521 }
522 495
523 if (is_alpha) {
524 s->block_coeff[4][0] = 0;
525 s->block_coeff[5][0] = 0;
526 }
527 return 0;496 return 0;
528}497}
529 498

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t