summaryrefslogtreecommitdiffstats
path: root/libhb/decomb.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2015-08-25 09:49:36 -0700
committerJohn Stebbins <[email protected]>2015-09-24 13:01:44 -0700
commit2f912311718e522b2fb5e2a06446fe84a4247025 (patch)
tree3edc8e0bf2940bf455e42c0d697c60b5995995e2 /libhb/decomb.c
parentf122f66319ba45d607cfa89ba8f5fcfa5fc44840 (diff)
libhb: add hb_buffer_list
This brings together several independent implementations of a simple buffer list manager.
Diffstat (limited to 'libhb/decomb.c')
-rw-r--r--libhb/decomb.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/libhb/decomb.c b/libhb/decomb.c
index b00d7ce27..3eaee3251 100644
--- a/libhb/decomb.c
+++ b/libhb/decomb.c
@@ -2545,8 +2545,9 @@ static int hb_decomb_work( hb_filter_object_t * filter,
{
hb_filter_private_t * pv = filter->private_data;
hb_buffer_t * in = *buf_in;
- hb_buffer_t * last = NULL, * out = NULL;
+ hb_buffer_list_t list;
+ hb_buffer_list_clear(&list);
if (in->s.flags & HB_BUF_FLAG_EOF)
{
*buf_out = in;
@@ -2625,22 +2626,15 @@ static int hb_decomb_work( hb_filter_object_t * filter,
pv->is_combed == 0 ||
frame == num_frames - 1)
{
- if ( out == NULL )
- {
- last = out = o_buf[idx];
- }
- else
- {
- last->next = o_buf[idx];
- last = last->next;
- }
- last->next = NULL;
+ /* Copy buffered settings to output buffer settings */
+ o_buf[idx]->s = pv->ref[1]->s;
+
+ o_buf[idx]->next = NULL;
+ hb_buffer_list_append(&list, o_buf[idx]);
// Indicate that buffer was consumed
o_buf[idx] = NULL;
- /* Copy buffered settings to output buffer settings */
- last->s = pv->ref[1]->s;
idx ^= 1;
if ((pv->mode & MODE_MASK) && pv->spatial_metric >= 0 )
@@ -2650,7 +2644,7 @@ static int hb_decomb_work( hb_filter_object_t * filter,
((pv->mode & MODE_MASK) && (pv->mode & MODE_GAMMA)) ||
pv->is_combed)
{
- apply_mask(pv, last);
+ apply_mask(pv, hb_buffer_list_tail(&list));
}
}
}
@@ -2662,13 +2656,14 @@ static int hb_decomb_work( hb_filter_object_t * filter,
the duration of the saved timestamps. */
if ((pv->mode & MODE_BOB) && pv->is_combed)
{
- out->s.stop -= (out->s.stop - out->s.start) / 2LL;
- last->s.start = out->s.stop;
- last->s.new_chap = 0;
+ hb_buffer_t *first = hb_buffer_list_head(&list);
+ hb_buffer_t *second = hb_buffer_list_tail(&list);
+ first->s.stop -= (first->s.stop - first->s.start) / 2LL;
+ second->s.start = first->s.stop;
+ second->s.new_chap = 0;
}
- *buf_out = out;
-
+ *buf_out = hb_buffer_list_clear(&list);
return HB_FILTER_OK;
}