MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / init_legacy_subpass

Function init_legacy_subpass

libswscale/graph.c:363–475  ·  view source on GitHub ↗

Takes over ownership of `sws` */

Source from the content-addressed store, hash-verified

361
362/* Takes over ownership of `sws` */
363static int init_legacy_subpass(SwsGraph *graph, SwsContext *sws,
364 SwsPass *input, SwsPass **output)
365{
366 SwsInternal *c = sws_internal(sws);
367 const int src_w = sws->src_w, src_h = sws->src_h;
368 const int dst_w = sws->dst_w, dst_h = sws->dst_h;
369 const int unscaled = src_w == dst_w && src_h == dst_h;
370 int align = c->dst_slice_align;
371 SwsPass *pass = NULL;
372 int ret;
373
374 if (c->cascaded_context[0]) {
375 const int num_cascaded = c->cascaded_context[2] ? 3 : 2;
376 for (int i = 0; i < num_cascaded; i++) {
377 const int is_last = i + 1 == num_cascaded;
378
379 /* Steal cascaded context, so we can manage its lifetime independently */
380 SwsContext *sub = c->cascaded_context[i];
381 c->cascaded_context[i] = NULL;
382
383 ret = init_legacy_subpass(graph, sub, input, is_last ? output : &input);
384 if (ret < 0)
385 break;
386 }
387
388 sws_free_context(&sws);
389 return ret;
390 }
391
392 if (sws->dither == SWS_DITHER_ED && !c->convert_unscaled)
393 align = 0; /* disable slice threading */
394
395 if (c->src0Alpha && !c->dst0Alpha && isALPHA(sws->dst_format)) {
396 ret = ff_sws_graph_add_pass(graph, AV_PIX_FMT_RGBA, src_w, src_h, input,
397 1, c, run_rgb0, &input);
398 if (ret < 0) {
399 sws_free_context(&sws);
400 return ret;
401 }
402 }
403
404 if (c->srcXYZ && !(c->dstXYZ && unscaled)) {
405 ret = ff_sws_graph_add_pass(graph, AV_PIX_FMT_RGB48, src_w, src_h, input,
406 1, c, run_xyz2rgb, &input);
407 if (ret < 0) {
408 sws_free_context(&sws);
409 return ret;
410 }
411 }
412
413 ret = ff_sws_graph_add_pass(graph, sws->dst_format, dst_w, dst_h, input, align, sws,
414 c->convert_unscaled ? run_legacy_unscaled : run_legacy_swscale,
415 &pass);
416 if (ret < 0) {
417 sws_free_context(&sws);
418 return ret;
419 }
420 pass->setup = setup_legacy_swscale;

Callers 1

add_legacy_sws_passFunction · 0.85

Calls 9

sws_internalFunction · 0.85
sws_free_contextFunction · 0.85
isALPHAFunction · 0.85
ff_sws_graph_add_passFunction · 0.85
av_callocFunction · 0.85
sws_alloc_contextFunction · 0.85
av_opt_copyFunction · 0.85
sws_setColorspaceDetailsFunction · 0.85

Tested by

no test coverage detected