int gavl_deinterlacer_init_scale(gavl_video_deinterlacer_t * d) { gavl_video_options_t * scaler_opt; gavl_video_format_t in_format; gavl_video_format_t out_format; if(!d->scaler) d->scaler = gavl_video_scaler_create(); scaler_opt = gavl_video_scaler_get_options(d->scaler); gavl_video_options_copy(scaler_opt, &d->opt); gavl_video_format_copy(&in_format, &d->format); gavl_video_format_copy(&out_format, &d->format); if(in_format.interlace_mode == GAVL_INTERLACE_NONE) in_format.interlace_mode = GAVL_INTERLACE_TOP_FIRST; out_format.interlace_mode = GAVL_INTERLACE_NONE; gavl_video_scaler_init(d->scaler, &in_format, &out_format); d->func = deinterlace_scale; return 1; }
static void * create_cropscale() { cropscale_priv_t * ret; ret = calloc(1, sizeof(*ret)); ret->scaler = gavl_video_scaler_create(); ret->opt = gavl_video_scaler_get_options(ret->scaler); ret->global_opt = gavl_video_options_create(); ret->border_color[3] = 1.0; return ret; }
livido_init_f init_instance( livido_port_t *my_instance ) { int width = 0, height = 0; lvd_extract_dimensions( my_instance, "out_channels", &width, &height ); scale0tilt_instance_t* inst = (scale0tilt_instance_t*)livido_malloc(sizeof(scale0tilt_instance_t)); livido_memset( inst, 0, sizeof(scale0tilt_instance_t) ); inst->w = width; inst->h = height; inst->sx = 1.0; inst->sy = 1.0; inst->format_src.frame_width = inst->w; inst->format_src.frame_height = inst->h; inst->format_src.image_width = inst->w; inst->format_src.image_height = inst->h; inst->format_src.pixel_width = 1; inst->format_src.pixel_height = 1; inst->format_src.pixelformat = GAVL_YUVJ_444_P; inst->video_scaler = gavl_video_scaler_create(); inst->frame_src = gavl_video_frame_create( NULL ); inst->frame_dst = gavl_video_frame_create( NULL ); inst->frame_src->strides[0] = width; inst->frame_src->strides[1] = width; inst->frame_src->strides[2] = width; inst->frame_dst->strides[0] = width; inst->frame_dst->strides[1] = width; inst->frame_dst->strides[2] = width; update_scaler(inst); inst->temp = gavl_video_frame_create( &(inst->format_src) ); inst->temp_alpha = gavl_video_frame_create( &(inst->format_src) ); livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR,1, &inst); return LIVIDO_NO_ERROR; }
static int add_context_scale(gavl_video_converter_t * cnv, const gavl_video_format_t * input_format, const gavl_video_format_t * output_format) { gavl_video_options_t * scaler_options; gavl_video_convert_context_t * ctx; ctx = add_context(cnv, input_format, output_format); ctx->scaler = gavl_video_scaler_create(); scaler_options = gavl_video_scaler_get_options(ctx->scaler); gavl_video_options_copy(scaler_options, &cnv->options); #if 0 fprintf(stderr, "gavl_video_scaler_init:\n"); fprintf(stderr, "src_format:\n"); gavl_video_format_dump(input_format); fprintf(stderr, "dst_format:\n"); gavl_video_format_dump(output_format); fprintf(stderr, "src_rectangle: "); gavl_rectangle_f_dump(&cnv->options.src_rect); fprintf(stderr, "\n"); fprintf(stderr, "dst_rectangle: "); gavl_rectangle_i_dump(&cnv->options.dst_rect); fprintf(stderr, "\n"); #endif if(!gavl_video_scaler_init(ctx->scaler, input_format, output_format)) { // fprintf(stderr, "Initializing scaler failed\n"); return 0; } ctx->func = scale_func; return 1; }