| 570 | } |
| 571 | |
| 572 | static int hb_decomb_work(hb_filter_object_t *filter, |
| 573 | hb_buffer_t **buf_in, |
| 574 | hb_buffer_t **buf_out) |
| 575 | { |
| 576 | hb_filter_private_t *pv = filter->private_data; |
| 577 | hb_buffer_t *in = *buf_in; |
| 578 | |
| 579 | // Input buffer is always consumed. |
| 580 | *buf_in = NULL; |
| 581 | if (in->s.flags & HB_BUF_FLAG_EOF) |
| 582 | { |
| 583 | if (pv->ref[2] != NULL) |
| 584 | { |
| 585 | // Duplicate last frame and process refs |
| 586 | store_ref(pv, hb_buffer_shallow_dup(pv->ref[2])); |
| 587 | process_frame(pv); |
| 588 | } |
| 589 | hb_buffer_list_append(&pv->out_list, in); |
| 590 | *buf_out = hb_buffer_list_clear(&pv->out_list); |
| 591 | return HB_FILTER_DONE; |
| 592 | } |
| 593 | |
| 594 | // yadif requires 3 buffers, prev, cur, and next. For the first |
| 595 | // frame, there can be no prev, so we duplicate the first frame. |
| 596 | if (!pv->ready) |
| 597 | { |
| 598 | // If yadif is not ready, store another ref and return HB_FILTER_DELAY |
| 599 | store_ref(pv, hb_buffer_shallow_dup(in)); |
| 600 | store_ref(pv, in); |
| 601 | pv->ready = 1; |
| 602 | // Wait for next |
| 603 | return HB_FILTER_DELAY; |
| 604 | } |
| 605 | |
| 606 | store_ref(pv, in); |
| 607 | process_frame(pv); |
| 608 | |
| 609 | *buf_out = hb_buffer_list_clear(&pv->out_list); |
| 610 | return HB_FILTER_OK; |
| 611 | } |
nothing calls this directly
no test coverage detected