Symbols with the sws_* prefix are exported.
Unified · Split
| @@ -31,7 +31,7 @@ · 30 unmodified lines | |||
| 31 | #include "libswscale/swscale.h" | 31 | #include "libswscale/swscale.h" |
| 32 | #include "utils.h" | 32 | #include "utils.h" |
| 33 | 33 | ||
| 34 | bool sws_color_map_noop(const SwsColorMap *map) | 34 | bool ff_sws_color_map_noop(const SwsColorMap *map) |
| 35 | { | 35 | { |
| 36 | /* If the encoding space is different, we must go through a conversion */ | 36 | /* If the encoding space is different, we must go through a conversion */ |
| 37 | if (map->src.prim != map->dst.prim || map->src.trc != map->dst.trc) | 37 | if (map->src.prim != map->dst.prim || map->src.trc != map->dst.trc) |
| @@ -676,14 +676,14 @@ static void generate_slice(void *priv, int jobnr, int threadnr, int nb_jobs, · 638 unmodified lines | |||
| 676 | } | 676 | } |
| 677 | } | 677 | } |
| 678 | 678 | ||
| 679 | int sws_color_map_generate_static(v3u16_t *lut, int size, const SwsColorMap *map) | 679 | int ff_sws_color_map_generate_static(v3u16_t *lut, int size, const SwsColorMap *map) |
| 680 | { | 680 | { |
| 681 | return sws_color_map_generate_dynamic(lut, NULL, size, 1, 1, map); | 681 | return ff_sws_color_map_generate_dynamic(lut, NULL, size, 1, 1, map); |
| 682 | } | 682 | } |
| 683 | 683 | ||
| 684 | int sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output, | 684 | int ff_sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output, |
| 685 | int size_input, int size_I, int size_PT, | 685 | int size_input, int size_I, int size_PT, |
| 686 | const SwsColorMap *map) | 686 | const SwsColorMap *map) |
| 687 | { | 687 | { |
| 688 | AVSliceThread *slicethread; | 688 | AVSliceThread *slicethread; |
| 689 | int ret, num_slices; | 689 | int ret, num_slices; |
| @@ -740,7 +740,7 @@ int sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output, · 50 unmodified lines | |||
| 740 | return 0; | 740 | return 0; |
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | void sws_tone_map_generate(v2u16_t *lut, int size, const SwsColorMap *map) | 743 | void ff_sws_tone_map_generate(v2u16_t *lut, int size, const SwsColorMap *map) |
| 744 | { | 744 | { |
| 745 | CmsCtx ctx = { | 745 | CmsCtx ctx = { |
| 746 | .map = *map, | 746 | .map = *map, |
| @@ -67,7 +67,7 @@ typedef struct SwsColorMap { · 66 unmodified lines | |||
| 67 | * Returns true if the given color map is a semantic no-op - that is, | 67 | * Returns true if the given color map is a semantic no-op - that is, |
| 68 | * the overall RGB end to end transform would an identity mapping. | 68 | * the overall RGB end to end transform would an identity mapping. |
| 69 | */ | 69 | */ |
| 70 | bool sws_color_map_noop(const SwsColorMap *map); | 70 | bool ff_sws_color_map_noop(const SwsColorMap *map); |
| 71 | 71 | ||
| 72 | /** | 72 | /** |
| 73 | * Generates a single end-to-end color mapping 3DLUT embedding a static tone | 73 | * Generates a single end-to-end color mapping 3DLUT embedding a static tone |
| @@ -75,19 +75,19 @@ bool sws_color_map_noop(const SwsColorMap *map); · 1 unmodified line | |||
| 75 | * | 75 | * |
| 76 | * Returns 0 on success, or a negative error code on failure. | 76 | * Returns 0 on success, or a negative error code on failure. |
| 77 | */ | 77 | */ |
| 78 | int sws_color_map_generate_static(v3u16_t *lut, int size, const SwsColorMap *map); | 78 | int ff_sws_color_map_generate_static(v3u16_t *lut, int size, const SwsColorMap *map); |
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| 81 | * Generates a split pair of 3DLUTS, going to IPT and back, allowing an | 81 | * Generates a split pair of 3DLUTS, going to IPT and back, allowing an |
| 82 | * arbitrary dynamic EETF to be nestled in between these two operations. | 82 | * arbitrary dynamic EETF to be nestled in between these two operations. |
| 83 | * | 83 | * |
| 84 | * See sws_tone_map_generate(). | 84 | * See ff_sws_tone_map_generate(). |
| 85 | * | 85 | * |
| 86 | * Returns 0 on success, or a negative error code on failure. | 86 | * Returns 0 on success, or a negative error code on failure. |
| 87 | */ | 87 | */ |
| 88 | int sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output, | 88 | int ff_sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output, |
| 89 | int size_input, int size_I, int size_PT, | 89 | int size_input, int size_I, int size_PT, |
| 90 | const SwsColorMap *map); | 90 | const SwsColorMap *map); |
| 91 | 91 | ||
| 92 | /** | 92 | /** |
| 93 | * Generate a 1D LUT of size `size` adapting intensity (I) levels from the | 93 | * Generate a 1D LUT of size `size` adapting intensity (I) levels from the |
| @@ -100,6 +100,6 @@ int sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output, · 6 unmodified lines | |||
| 100 | * | 100 | * |
| 101 | * Returns 0 on success, or a negative error code on failure. | 101 | * Returns 0 on success, or a negative error code on failure. |
| 102 | */ | 102 | */ |
| 103 | void sws_tone_map_generate(v2u16_t *lut, int size, const SwsColorMap *map); | 103 | void ff_sws_tone_map_generate(v2u16_t *lut, int size, const SwsColorMap *map); |
| 104 | 104 | ||
| 105 | #endif // SWSCALE_GAMUT_MAPPING_H | 105 | #endif // SWSCALE_GAMUT_MAPPING_H |
| @@ -472,7 +472,7 @@ static int add_legacy_sws_pass(SwsGraph *graph, SwsFormat src, SwsFormat dst, · 471 unmodified lines | |||
| 472 | static void free_lut3d(void *priv) | 472 | static void free_lut3d(void *priv) |
| 473 | { | 473 | { |
| 474 | SwsLut3D *lut = priv; | 474 | SwsLut3D *lut = priv; |
| 475 | sws_lut3d_free(&lut); | 475 | ff_sws_lut3d_free(&lut); |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | static void setup_lut3d(const SwsImg *out, const SwsImg *in, const SwsPass *pass) | 478 | static void setup_lut3d(const SwsImg *out, const SwsImg *in, const SwsPass *pass) |
| @@ -480,7 +480,7 @@ static void setup_lut3d(const SwsImg *out, const SwsImg *in, const SwsPass *pass · 1 unmodified line | |||
| 480 | SwsLut3D *lut = pass->priv; | 480 | SwsLut3D *lut = pass->priv; |
| 481 | 481 | ||
| 482 | /* Update dynamic frame metadata from the original source frame */ | 482 | /* Update dynamic frame metadata from the original source frame */ |
| 483 | sws_lut3d_update(lut, &pass->graph->src.color); | 483 | ff_sws_lut3d_update(lut, &pass->graph->src.color); |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | static void run_lut3d(const SwsImg *out_base, const SwsImg *in_base, | 486 | static void run_lut3d(const SwsImg *out_base, const SwsImg *in_base, |
| @@ -490,8 +490,8 @@ static void run_lut3d(const SwsImg *out_base, const SwsImg *in_base, · 3 unmodified lines | |||
| 490 | const SwsImg in = shift_img(in_base, y); | 490 | const SwsImg in = shift_img(in_base, y); |
| 491 | const SwsImg out = shift_img(out_base, y); | 491 | const SwsImg out = shift_img(out_base, y); |
| 492 | 492 | ||
| 493 | sws_lut3d_apply(lut, in.data[0], in.linesize[0], out.data[0], | 493 | ff_sws_lut3d_apply(lut, in.data[0], in.linesize[0], out.data[0], |
| 494 | out.linesize[0], pass->width, h); | 494 | out.linesize[0], pass->width, h); |
| 495 | } | 495 | } |
| 496 | 496 | ||
| 497 | static int adapt_colors(SwsGraph *graph, SwsFormat src, SwsFormat dst, | 497 | static int adapt_colors(SwsGraph *graph, SwsFormat src, SwsFormat dst, |
| @@ -522,15 +522,15 @@ static int adapt_colors(SwsGraph *graph, SwsFormat src, SwsFormat dst, · 24 unmodified lines | |||
| 522 | map.src = src.color; | 522 | map.src = src.color; |
| 523 | map.dst = dst.color; | 523 | map.dst = dst.color; |
| 524 | 524 | ||
| 525 | if (sws_color_map_noop(&map)) | 525 | if (ff_sws_color_map_noop(&map)) |
| 526 | return 0; | 526 | return 0; |
| 527 | 527 | ||
| 528 | lut = sws_lut3d_alloc(); | 528 | lut = ff_sws_lut3d_alloc(); |
| 529 | if (!lut) | 529 | if (!lut) |
| 530 | return AVERROR(ENOMEM); | 530 | return AVERROR(ENOMEM); |
| 531 | 531 | ||
| 532 | fmt_in = sws_lut3d_pick_pixfmt(src, 0); | 532 | fmt_in = ff_sws_lut3d_pick_pixfmt(src, 0); |
| 533 | fmt_out = sws_lut3d_pick_pixfmt(dst, 1); | 533 | fmt_out = ff_sws_lut3d_pick_pixfmt(dst, 1); |
| 534 | if (fmt_in != src.format) { | 534 | if (fmt_in != src.format) { |
| 535 | SwsFormat tmp = src; | 535 | SwsFormat tmp = src; |
| 536 | tmp.format = fmt_in; | 536 | tmp.format = fmt_in; |
| @@ -539,16 +539,16 @@ static int adapt_colors(SwsGraph *graph, SwsFormat src, SwsFormat dst, · 2 unmodified lines | |||
| 539 | return ret; | 539 | return ret; |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | ret = sws_lut3d_generate(lut, fmt_in, fmt_out, &map); | 542 | ret = ff_sws_lut3d_generate(lut, fmt_in, fmt_out, &map); |
| 543 | if (ret < 0) { | 543 | if (ret < 0) { |
| 544 | sws_lut3d_free(&lut); | 544 | ff_sws_lut3d_free(&lut); |
| 545 | return ret; | 545 | return ret; |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | pass = pass_add(graph, lut, fmt_out, src.width, src.height, | 548 | pass = pass_add(graph, lut, fmt_out, src.width, src.height, |
| 549 | input, 1, run_lut3d); | 549 | input, 1, run_lut3d); |
| 550 | if (!pass) { | 550 | if (!pass) { |
| 551 | sws_lut3d_free(&lut); | 551 | ff_sws_lut3d_free(&lut); |
| 552 | return AVERROR(ENOMEM); | 552 | return AVERROR(ENOMEM); |
| 553 | } | 553 | } |
| 554 | pass->setup = setup_lut3d; | 554 | pass->setup = setup_lut3d; |
| @@ -607,8 +607,8 @@ static void sws_graph_worker(void *priv, int jobnr, int threadnr, int nb_jobs, · 52 unmodified lines | |||
| 607 | pass->run(output, input, slice_y, slice_h, pass); | 607 | pass->run(output, input, slice_y, slice_h, pass); |
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | int sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, | 610 | int ff_sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, |
| 611 | int field, SwsGraph **out_graph) | 611 | int field, SwsGraph **out_graph) |
| 612 | { | 612 | { |
| 613 | int ret; | 613 | int ret; |
| 614 | SwsGraph *graph = av_mallocz(sizeof(*graph)); | 614 | SwsGraph *graph = av_mallocz(sizeof(*graph)); |
| @@ -641,11 +641,11 @@ int sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src · 26 unmodified lines | |||
| 641 | return 0; | 641 | return 0; |
| 642 | 642 | ||
| 643 | error: | 643 | error: |
| 644 | sws_graph_free(&graph); | 644 | ff_sws_graph_free(&graph); |
| 645 | return ret; | 645 | return ret; |
| 646 | } | 646 | } |
| 647 | 647 | ||
| 648 | void sws_graph_free(SwsGraph **pgraph) | 648 | void ff_sws_graph_free(SwsGraph **pgraph) |
| 649 | { | 649 | { |
| 650 | SwsGraph *graph = *pgraph; | 650 | SwsGraph *graph = *pgraph; |
| 651 | if (!graph) | 651 | if (!graph) |
| @@ -684,23 +684,23 @@ static int opts_equal(const SwsContext *c1, const SwsContext *c2) · 32 unmodified lines | |||
| 684 | 684 | ||
| 685 | } | 685 | } |
| 686 | 686 | ||
| 687 | int sws_graph_reinit(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, | 687 | int ff_sws_graph_reinit(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, |
| 688 | int field, SwsGraph **out_graph) | 688 | int field, SwsGraph **out_graph) |
| 689 | { | 689 | { |
| 690 | SwsGraph *graph = *out_graph; | 690 | SwsGraph *graph = *out_graph; |
| 691 | if (graph && ff_fmt_equal(&graph->src, src) && | 691 | if (graph && ff_fmt_equal(&graph->src, src) && |
| 692 | ff_fmt_equal(&graph->dst, dst) && | 692 | ff_fmt_equal(&graph->dst, dst) && |
| 693 | opts_equal(ctx, &graph->opts_copy)) | 693 | opts_equal(ctx, &graph->opts_copy)) |
| 694 | { | 694 | { |
| 695 | sws_graph_update_metadata(graph, &src->color); | 695 | ff_sws_graph_update_metadata(graph, &src->color); |
| 696 | return 0; | 696 | return 0; |
| 697 | } | 697 | } |
| 698 | 698 | ||
| 699 | sws_graph_free(out_graph); | 699 | ff_sws_graph_free(out_graph); |
| 700 | return sws_graph_create(ctx, dst, src, field, out_graph); | 700 | return ff_sws_graph_create(ctx, dst, src, field, out_graph); |
| 701 | } | 701 | } |
| 702 | 702 | ||
| 703 | void sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color) | 703 | void ff_sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color) |
| 704 | { | 704 | { |
| 705 | if (!color) | 705 | if (!color) |
| 706 | return; | 706 | return; |
| @@ -708,10 +708,10 @@ void sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color) · 1 unmodified line | |||
| 708 | ff_color_update_dynamic(&graph->src.color, color); | 708 | ff_color_update_dynamic(&graph->src.color, color); |
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | void sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4], | 711 | void ff_sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4], |
| 712 | const int out_linesize[4], | 712 | const int out_linesize[4], |
| 713 | const uint8_t *const in_data[4], | 713 | const uint8_t *const in_data[4], |
| 714 | const int in_linesize[4]) | 714 | const int in_linesize[4]) |
| 715 | { | 715 | { |
| 716 | SwsImg *out = &graph->exec.output; | 716 | SwsImg *out = &graph->exec.output; |
| 717 | SwsImg *in = &graph->exec.input; | 717 | SwsImg *in = &graph->exec.input; |
| @@ -114,7 +114,7 @@ typedef struct SwsGraph { · 113 unmodified lines | |||
| 114 | SwsFormat src, dst; | 114 | SwsFormat src, dst; |
| 115 | int field; | 115 | int field; |
| 116 | 116 | ||
| 117 | /** Temporary execution state inside sws_graph_run */ | 117 | /** Temporary execution state inside ff_sws_graph_run */ |
| 118 | struct { | 118 | struct { |
| 119 | const SwsPass *pass; /* current filter pass */ | 119 | const SwsPass *pass; /* current filter pass */ |
| 120 | SwsImg input; | 120 | SwsImg input; |
| @@ -125,34 +125,34 @@ typedef struct SwsGraph { · 4 unmodified lines | |||
| 125 | /** | 125 | /** |
| 126 | * Allocate and initialize the filter graph. Returns 0 or a negative error. | 126 | * Allocate and initialize the filter graph. Returns 0 or a negative error. |
| 127 | */ | 127 | */ |
| 128 | int sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, | 128 | int ff_sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, |
| 129 | int field, SwsGraph **out_graph); | 129 | int field, SwsGraph **out_graph); |
| 130 | 130 | ||
| 131 | /** | 131 | /** |
| 132 | * Uninitialize any state associate with this filter graph and free it. | 132 | * Uninitialize any state associate with this filter graph and free it. |
| 133 | */ | 133 | */ |
| 134 | void sws_graph_free(SwsGraph **graph); | 134 | void ff_sws_graph_free(SwsGraph **graph); |
| 135 | 135 | ||
| 136 | /** | 136 | /** |
| 137 | * Update dynamic per-frame HDR metadata without requiring a full reinit. | 137 | * Update dynamic per-frame HDR metadata without requiring a full reinit. |
| 138 | */ | 138 | */ |
| 139 | void sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color); | 139 | void ff_sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color); |
| 140 | 140 | ||
| 141 | /** | 141 | /** |
| 142 | * Wrapper around sws_graph_create() that reuses the existing graph if the | 142 | * Wrapper around ff_sws_graph_create() that reuses the existing graph if the |
| 143 | * format is compatible. This will also update dynamic per-frame metadata. | 143 | * format is compatible. This will also update dynamic per-frame metadata. |
| 144 | * Must be called after changing any of the fields in `ctx`, or else they will | 144 | * Must be called after changing any of the fields in `ctx`, or else they will |
| 145 | * have no effect. | 145 | * have no effect. |
| 146 | */ | 146 | */ |
| 147 | int sws_graph_reinit(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, | 147 | int ff_sws_graph_reinit(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src, |
| 148 | int field, SwsGraph **graph); | 148 | int field, SwsGraph **graph); |
| 149 | 149 | ||
| 150 | /** | 150 | /** |
| 151 | * Dispatch the filter graph on a single field. Internally threaded. | 151 | * Dispatch the filter graph on a single field. Internally threaded. |
| 152 | */ | 152 | */ |
| 153 | void sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4], | 153 | void ff_sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4], |
| 154 | const int out_linesize[4], | 154 | const int out_linesize[4], |
| 155 | const uint8_t *const in_data[4], | 155 | const uint8_t *const in_data[4], |
| 156 | const int in_linesize[4]); | 156 | const int in_linesize[4]); |
| 157 | 157 | ||
| 158 | #endif /* SWSCALE_GRAPH_H */ | 158 | #endif /* SWSCALE_GRAPH_H */ |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include "csputils.h" | 29 | #include "csputils.h" |
| 30 | #include "lut3d.h" | 30 | #include "lut3d.h" |
| 31 | 31 | ||
| 32 | SwsLut3D *sws_lut3d_alloc(void) | 32 | SwsLut3D *ff_sws_lut3d_alloc(void) |
| 33 | { | 33 | { |
| 34 | SwsLut3D *lut3d = av_malloc(sizeof(*lut3d)); | 34 | SwsLut3D *lut3d = av_malloc(sizeof(*lut3d)); |
| 35 | if (!lut3d) | 35 | if (!lut3d) |
| @@ -39,17 +39,17 @@ SwsLut3D *sws_lut3d_alloc(void) · 3 unmodified lines | |||
| 39 | return lut3d; | 39 | return lut3d; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | void sws_lut3d_free(SwsLut3D **plut3d) | 42 | void ff_sws_lut3d_free(SwsLut3D **plut3d) |
| 43 | { | 43 | { |
| 44 | av_freep(plut3d); | 44 | av_freep(plut3d); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | bool sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output) | 47 | bool ff_sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output) |
| 48 | { | 48 | { |
| 49 | return fmt == AV_PIX_FMT_RGBA64; | 49 | return fmt == AV_PIX_FMT_RGBA64; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | enum AVPixelFormat sws_lut3d_pick_pixfmt(SwsFormat fmt, int output) | 52 | enum AVPixelFormat ff_sws_lut3d_pick_pixfmt(SwsFormat fmt, int output) |
| 53 | { | 53 | { |
| 54 | return AV_PIX_FMT_RGBA64; | 54 | return AV_PIX_FMT_RGBA64; |
| 55 | } | 55 | } |
| @@ -221,19 +221,19 @@ static av_always_inline v3u16_t apply_tone_map(const SwsLut3D *lut3d, v3u16_t ip · 165 unmodified lines | |||
| 221 | return ipt; | 221 | return ipt; |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | int sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in, | 224 | int ff_sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in, |
| 225 | enum AVPixelFormat fmt_out, const SwsColorMap *map) | 225 | enum AVPixelFormat fmt_out, const SwsColorMap *map) |
| 226 | { | 226 | { |
| 227 | int ret; | 227 | int ret; |
| 228 | 228 | ||
| 229 | if (!sws_lut3d_test_fmt(fmt_in, 0) || !sws_lut3d_test_fmt(fmt_out, 1)) | 229 | if (!ff_sws_lut3d_test_fmt(fmt_in, 0) || !ff_sws_lut3d_test_fmt(fmt_out, 1)) |
| 230 | return AVERROR(EINVAL); | 230 | return AVERROR(EINVAL); |
| 231 | 231 | ||
| 232 | lut3d->dynamic = map->src.frame_peak.num > 0; | 232 | lut3d->dynamic = map->src.frame_peak.num > 0; |
| 233 | lut3d->map = *map; | 233 | lut3d->map = *map; |
| 234 | 234 | ||
| 235 | if (lut3d->dynamic) { | 235 | if (lut3d->dynamic) { |
| 236 | ret = sws_color_map_generate_dynamic(&lut3d->input[0][0][0], | 236 | ret = ff_sws_color_map_generate_dynamic(&lut3d->input[0][0][0], |
| 237 | &lut3d->output[0][0][0], | 237 | &lut3d->output[0][0][0], |
| 238 | INPUT_LUT_SIZE, OUTPUT_LUT_SIZE_I, | 238 | INPUT_LUT_SIZE, OUTPUT_LUT_SIZE_I, |
| 239 | OUTPUT_LUT_SIZE_PT, map); | 239 | OUTPUT_LUT_SIZE_PT, map); |
| @@ -241,15 +241,15 @@ int sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in, · 1 unmodified line | |||
| 241 | return ret; | 241 | return ret; |
| 242 | 242 | ||
| 243 | /* Make sure initial state is valid */ | 243 | /* Make sure initial state is valid */ |
| 244 | sws_lut3d_update(lut3d, &map->src); | 244 | ff_sws_lut3d_update(lut3d, &map->src); |
| 245 | return 0; | 245 | return 0; |
| 246 | } else { | 246 | } else { |
| 247 | return sws_color_map_generate_static(&lut3d->input[0][0][0], | 247 | return ff_sws_color_map_generate_static(&lut3d->input[0][0][0], |
| 248 | INPUT_LUT_SIZE, map); | 248 | INPUT_LUT_SIZE, map); |
| 249 | } | 249 | } |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | void sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src) | 252 | void ff_sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src) |
| 253 | { | 253 | { |
| 254 | if (!new_src || !lut3d->dynamic) | 254 | if (!new_src || !lut3d->dynamic) |
| 255 | return; | 255 | return; |
| @@ -257,11 +257,11 @@ void sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src) · 1 unmodified line | |||
| 257 | lut3d->map.src.frame_peak = new_src->frame_peak; | 257 | lut3d->map.src.frame_peak = new_src->frame_peak; |
| 258 | lut3d->map.src.frame_avg = new_src->frame_avg; | 258 | lut3d->map.src.frame_avg = new_src->frame_avg; |
| 259 | 259 | ||
| 260 | sws_tone_map_generate(lut3d->tone_map, TONE_LUT_SIZE, &lut3d->map); | 260 | ff_sws_tone_map_generate(lut3d->tone_map, TONE_LUT_SIZE, &lut3d->map); |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | void sws_lut3d_apply(const SwsLut3D *lut3d, const uint8_t *in, int in_stride, | 263 | void ff_sws_lut3d_apply(const SwsLut3D *lut3d, const uint8_t *in, int in_stride, |
| 264 | uint8_t *out, int out_stride, int w, int h) | 264 | uint8_t *out, int out_stride, int w, int h) |
| 265 | { | 265 | { |
| 266 | while (h--) { | 266 | while (h--) { |
| 267 | const uint16_t *in16 = (const uint16_t *) in; | 267 | const uint16_t *in16 = (const uint16_t *) in; |
| @@ -59,40 +59,40 @@ typedef struct SwsLut3D { · 58 unmodified lines | |||
| 59 | v2u16_t tone_map[TONE_LUT_SIZE]; /* new luma, desaturation */ | 59 | v2u16_t tone_map[TONE_LUT_SIZE]; /* new luma, desaturation */ |
| 60 | } SwsLut3D; | 60 | } SwsLut3D; |
| 61 | 61 | ||
| 62 | SwsLut3D *sws_lut3d_alloc(void); | 62 | SwsLut3D *ff_sws_lut3d_alloc(void); |
| 63 | void sws_lut3d_free(SwsLut3D **lut3d); | 63 | void ff_sws_lut3d_free(SwsLut3D **lut3d); |
| 64 | 64 | ||
| 65 | /** | 65 | /** |
| 66 | * Test to see if a given format is supported by the 3DLUT input/output code. | 66 | * Test to see if a given format is supported by the 3DLUT input/output code. |
| 67 | */ | 67 | */ |
| 68 | bool sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output); | 68 | bool ff_sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output); |
| 69 | 69 | ||
| 70 | /** | 70 | /** |
| 71 | * Pick the best compatible pixfmt for a given SwsFormat. | 71 | * Pick the best compatible pixfmt for a given SwsFormat. |
| 72 | */ | 72 | */ |
| 73 | enum AVPixelFormat sws_lut3d_pick_pixfmt(SwsFormat fmt, int output); | 73 | enum AVPixelFormat ff_sws_lut3d_pick_pixfmt(SwsFormat fmt, int output); |
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | * Recalculate the (static) 3DLUT state with new settings. This will recompute | 76 | * Recalculate the (static) 3DLUT state with new settings. This will recompute |
| 77 | * everything. To only update per-frame tone mapping state, instead call | 77 | * everything. To only update per-frame tone mapping state, instead call |
| 78 | * sws_lut3d_update(). | 78 | * ff_sws_lut3d_update(). |
| 79 | * | 79 | * |
| 80 | * Returns 0 or a negative error code. | 80 | * Returns 0 or a negative error code. |
| 81 | */ | 81 | */ |
| 82 | int sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in, | 82 | int ff_sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in, |
| 83 | enum AVPixelFormat fmt_out, const SwsColorMap *map); | 83 | enum AVPixelFormat fmt_out, const SwsColorMap *map); |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
| 86 | * Update the tone mapping state. This will only use per-frame metadata. The | 86 | * Update the tone mapping state. This will only use per-frame metadata. The |
| 87 | * static metadata is ignored. | 87 | * static metadata is ignored. |
| 88 | */ | 88 | */ |
| 89 | void sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src); | 89 | void ff_sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src); |
| 90 | 90 | ||
| 91 | /** | 91 | /** |
| 92 | * Applies a color transformation to a plane. The format must match the format | 92 | * Applies a color transformation to a plane. The format must match the format |
| 93 | * provided during sws_lut3d_update(). | 93 | * provided during ff_sws_lut3d_update(). |
| 94 | */ | 94 | */ |
| 95 | void sws_lut3d_apply(const SwsLut3D *lut3d, const uint8_t *in, int in_stride, | 95 | void ff_sws_lut3d_apply(const SwsLut3D *lut3d, const uint8_t *in, int in_stride, |
| 96 | uint8_t *out, int out_stride, int w, int h); | 96 | uint8_t *out, int out_stride, int w, int h); |
| 97 | 97 | ||
| 98 | #endif /* SWSCALE_LUT3D_H */ | 98 | #endif /* SWSCALE_LUT3D_H */ |
| @@ -1403,7 +1403,7 @@ int sws_scale_frame(SwsContext *sws, AVFrame *dst, const AVFrame *src) · 1402 unmodified lines | |||
| 1403 | int dst_linesize[4], src_linesize[4]; | 1403 | int dst_linesize[4], src_linesize[4]; |
| 1404 | get_frame_pointers(dst, dst_data, dst_linesize, field); | 1404 | get_frame_pointers(dst, dst_data, dst_linesize, field); |
| 1405 | get_frame_pointers(src, src_data, src_linesize, field); | 1405 | get_frame_pointers(src, src_data, src_linesize, field); |
| 1406 | sws_graph_run(graph, dst_data, dst_linesize, | 1406 | ff_sws_graph_run(graph, dst_data, dst_linesize, |
| 1407 | (const uint8_t **) src_data, src_linesize); | 1407 | (const uint8_t **) src_data, src_linesize); |
| 1408 | if (!graph->dst.interlaced) | 1408 | if (!graph->dst.interlaced) |
| 1409 | break; | 1409 | break; |
| @@ -1461,7 +1461,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src) · 51 unmodified lines | |||
| 1461 | goto fail; | 1461 | goto fail; |
| 1462 | } | 1462 | } |
| 1463 | 1463 | ||
| 1464 | ret = sws_graph_reinit(ctx, &dst_fmt, &src_fmt, field, &s->graph[field]); | 1464 | ret = ff_sws_graph_reinit(ctx, &dst_fmt, &src_fmt, field, &s->graph[field]); |
| 1465 | if (ret < 0) { | 1465 | if (ret < 0) { |
| 1466 | err_msg = "Failed initializing scaling graph"; | 1466 | err_msg = "Failed initializing scaling graph"; |
| 1467 | goto fail; | 1467 | goto fail; |
| @@ -1474,7 +1474,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src) · 6 unmodified lines | |||
| 1474 | } | 1474 | } |
| 1475 | 1475 | ||
| 1476 | if (!src_fmt.interlaced) { | 1476 | if (!src_fmt.interlaced) { |
| 1477 | sws_graph_free(&s->graph[FIELD_BOTTOM]); | 1477 | ff_sws_graph_free(&s->graph[FIELD_BOTTOM]); |
| 1478 | break; | 1478 | break; |
| 1479 | } | 1479 | } |
| 1480 | 1480 | ||
| @@ -1490,7 +1490,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src) · 9 unmodified lines | |||
| 1490 | av_color_primaries_name(dst_fmt.color.prim), av_color_transfer_name(dst_fmt.color.trc)); | 1490 | av_color_primaries_name(dst_fmt.color.prim), av_color_transfer_name(dst_fmt.color.trc)); |
| 1491 | 1491 | ||
| 1492 | for (int i = 0; i < FF_ARRAY_ELEMS(s->graph); i++) | 1492 | for (int i = 0; i < FF_ARRAY_ELEMS(s->graph); i++) |
| 1493 | sws_graph_free(&s->graph[i]); | 1493 | ff_sws_graph_free(&s->graph[i]); |
| 1494 | 1494 | ||
| 1495 | return ret; | 1495 | return ret; |
| 1496 | } | 1496 | } |
| @@ -2480,7 +2480,7 @@ void sws_freeContext(SwsContext *sws) · 2479 unmodified lines | |||
| 2480 | return; | 2480 | return; |
| 2481 | 2481 | ||
| 2482 | for (i = 0; i < FF_ARRAY_ELEMS(c->graph); i++) | 2482 | for (i = 0; i < FF_ARRAY_ELEMS(c->graph); i++) |
| 2483 | sws_graph_free(&c->graph[i]); | 2483 | ff_sws_graph_free(&c->graph[i]); |
| 2484 | 2484 | ||
| 2485 | for (i = 0; i < c->nb_slice_ctx; i++) | 2485 | for (i = 0; i < c->nb_slice_ctx; i++) |
| 2486 | sws_freeContext(c->slice_ctx[i]); | 2486 | sws_freeContext(c->slice_ctx[i]); |