History

avcodec/vp56: Factorize vp56_render_mb() out

Michael Niedermayer committed 9 years ago

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

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
400400 }
401401 }
402402
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)
404404 {
405− AVFrame *frame_current, *frame_ref;
406− VP56mb mb_type;
407− VP56Frame ref_frame;
408405 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];
420408
421409 vp56_add_predictors_dc(s, ref_frame);
422410
423411 frame_current = s->frames[VP56_FRAME_CURRENT];
424412 frame_ref = s->frames[ref_frame];
425413 if (mb_type != VP56_MB_INTRA && !frame_ref->data[0])
426− return 0;
414+ return;
427415
428416 ab = 6*is_alpha;
429417 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
473461 s->block_coeff[4][0] = 0;
474462 s->block_coeff[5][0] = 0;
475463 }
476− return 0;
477464 }
478465
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)
480467 {
481− AVFrame *frame_current, *frame_ref;
482468 VP56mb mb_type;
483− VP56Frame ref_frame;
484− int b, ab, b_max, plane, off;
469+ int ret;
485470
486471 if (s->frames[VP56_FRAME_CURRENT]->key_frame)
487472 mb_type = VP56_MB_INTRA;
488473 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);
491475
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;
496479
497− ab = 6*is_alpha;
498− b_max = 6 - 2*is_alpha;
480+ vp56_render_mb(s, row, col, is_alpha, mb_type);
499481
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+}
508484
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);
522495
523− if (is_alpha) {
524− s->block_coeff[4][0] = 0;
525− s->block_coeff[5][0] = 0;
526− }
527496 return 0;
528497 }
529498

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