| 497 | } |
| 498 | |
| 499 | static void process_frame(hb_filter_private_t *pv) |
| 500 | { |
| 501 | if ((pv->mode & MODE_DECOMB_SELECTIVE) && |
| 502 | pv->ref[1]->s.combed == HB_COMB_NONE) |
| 503 | { |
| 504 | // Input buffer is not combed. Just make a dup of it. |
| 505 | hb_buffer_t *buf = hb_buffer_shallow_dup(pv->ref[1]); |
| 506 | hb_buffer_list_append(&pv->out_list, buf); |
| 507 | pv->frames++; |
| 508 | pv->unfiltered++; |
| 509 | } |
| 510 | else |
| 511 | { |
| 512 | // Determine if top-field first layout |
| 513 | int tff; |
| 514 | if (pv->parity < 0) |
| 515 | { |
| 516 | uint16_t flags = pv->ref[1]->s.flags; |
| 517 | tff = ((flags & PIC_FLAG_PROGRESSIVE_FRAME) == 0) ? |
| 518 | !!(flags & PIC_FLAG_TOP_FIELD_FIRST) : 1; |
| 519 | } |
| 520 | else |
| 521 | { |
| 522 | tff = (pv->parity & 1) ^ 1; |
| 523 | } |
| 524 | |
| 525 | // Deinterlace both fields if bob |
| 526 | int frame, num_frames = 1; |
| 527 | if (pv->mode & MODE_DECOMB_BOB) |
| 528 | { |
| 529 | num_frames = 2; |
| 530 | } |
| 531 | |
| 532 | // Will need up to 2 buffers simultaneously |
| 533 | |
| 534 | // Perform filtering |
| 535 | for (frame = 0; frame < num_frames; frame++) |
| 536 | { |
| 537 | hb_buffer_t *buf; |
| 538 | int parity = frame ^ tff ^ 1; |
| 539 | |
| 540 | // tff for eedi2 |
| 541 | pv->tff = !parity; |
| 542 | |
| 543 | buf = hb_frame_buffer_init(pv->ref[1]->f.fmt, |
| 544 | pv->ref[1]->f.width, |
| 545 | pv->ref[1]->f.height); |
| 546 | buf->f.color_prim = pv->output.color_prim; |
| 547 | buf->f.color_transfer = pv->output.color_transfer; |
| 548 | buf->f.color_matrix = pv->output.color_matrix; |
| 549 | buf->f.color_range = pv->output.color_range; |
| 550 | buf->f.chroma_location = pv->output.chroma_location; |
| 551 | pv->filter(pv, buf, parity, tff); |
| 552 | |
| 553 | // Copy buffered settings to output buffer settings |
| 554 | hb_buffer_copy_props(buf, pv->ref[1]); |
| 555 | |
| 556 | hb_buffer_list_append(&pv->out_list, buf); |
no test coverage detected