From 3712b297c3487780d31151362b85c49ca27ff8ad Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Fri, 15 Mar 2019 15:27:01 -0600 Subject: libhb: propagate color matrix info through the pipeline Propagates pix_fmt, range, primaries, transfer, and matrix everywhere. Everything that passes or creates video frames tags the frames with their color matrix info. All filters know the expected color matrix info of input frames. --- libhb/detelecine.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'libhb/detelecine.c') diff --git a/libhb/detelecine.c b/libhb/detelecine.c index a0a5367f1..a9abf8601 100644 --- a/libhb/detelecine.c +++ b/libhb/detelecine.c @@ -92,6 +92,9 @@ struct hb_filter_private_s struct pullup_context * pullup_ctx; int pullup_fakecount; int pullup_skipflag; + + hb_filter_init_t input; + hb_filter_init_t output; }; static int hb_detelecine_init( hb_filter_object_t * filter, @@ -821,10 +824,12 @@ void pullup_flush_fields( struct pullup_context * c ) static int hb_detelecine_init( hb_filter_object_t * filter, hb_filter_init_t * init ) { - filter->private_data = calloc( sizeof(struct hb_filter_private_s), 1 ); - hb_filter_private_t * pv = filter->private_data; + filter->private_data = calloc(sizeof(struct hb_filter_private_s), 1); + hb_filter_private_t * pv = filter->private_data; struct pullup_context * ctx; + + pv->input = *init; pv->pullup_ctx = ctx = pullup_alloc_context(); ctx->junk_left = ctx->junk_right = 1; @@ -877,6 +882,7 @@ static int hb_detelecine_init( hb_filter_object_t * filter, pv->pullup_skipflag = 0; init->job->use_detelecine = 1; + pv->output = *init; return 0; } @@ -1017,7 +1023,11 @@ static int hb_detelecine_work( hb_filter_object_t * filter, pullup_pack_frame( ctx, frame ); } - out = hb_video_buffer_init( in->f.width, in->f.height ); + out = hb_frame_buffer_init(pv->output.pix_fmt, in->f.width, in->f.height); + out->f.color_prim = pv->output.color_prim; + out->f.color_transfer = pv->output.color_transfer; + out->f.color_matrix = pv->output.color_matrix; + out->f.color_range = pv->output.color_range ; /* Copy pullup frame buffer into output buffer */ memcpy( out->plane[0].data, frame->buffer->planes[0], frame->buffer->size[0] ); -- cgit v1.2.3