History

swscale/cms,graph,lut3d: Use ff_-prefix, don't export internal functions

Symbols with the sws_* prefix are exported.

Andreas Rheinhardt committed 1 year ago

Commit 4973bb61 parent 0bc1d2f8 files · +81 −81Browse files

Unified · Split

8 files
  1. libswscale/cms.c +7 −7
  2. libswscale/cms.h +7 −7
  3. libswscale/graph.c +25 −25
  4. libswscale/graph.h +12 −12
  5. libswscale/lut3d.c +14 −14
  6. libswscale/lut3d.h +11 −11
  7. libswscale/swscale.c +4 −4
  8. libswscale/utils.c +1 −1
libswscale/cms.c+7−7
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131 #include "libswscale/swscale.h"
3232 #include "utils.h"
3333
34−bool sws_color_map_noop(const SwsColorMap *map)
34+bool ff_sws_color_map_noop(const SwsColorMap *map)
3535 {
3636 /* If the encoding space is different, we must go through a conversion */
3737 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
676676 }
677677 }
678678
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)
680680 {
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);
682682 }
683683
684−int sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output,
685− int size_input, int size_I, int size_PT,
686− const SwsColorMap *map)
684+int ff_sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output,
685+ int size_input, int size_I, int size_PT,
686+ const SwsColorMap *map)
687687 {
688688 AVSliceThread *slicethread;
689689 int ret, num_slices;
@@ -740,7 +740,7 @@ int sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output, · 50 unmodified lines
740740 return 0;
741741 }
742742
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)
744744 {
745745 CmsCtx ctx = {
746746 .map = *map,
libswscale/cms.h+7−7
@@ -67,7 +67,7 @@ typedef struct SwsColorMap { · 66 unmodified lines
6767 * Returns true if the given color map is a semantic no-op - that is,
6868 * the overall RGB end to end transform would an identity mapping.
6969 */
70−bool sws_color_map_noop(const SwsColorMap *map);
70+bool ff_sws_color_map_noop(const SwsColorMap *map);
7171
7272 /**
7373 * 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
7575 *
7676 * Returns 0 on success, or a negative error code on failure.
7777 */
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);
7979
8080 /**
8181 * Generates a split pair of 3DLUTS, going to IPT and back, allowing an
8282 * arbitrary dynamic EETF to be nestled in between these two operations.
8383 *
84− * See sws_tone_map_generate().
84+ * See ff_sws_tone_map_generate().
8585 *
8686 * Returns 0 on success, or a negative error code on failure.
8787 */
88−int sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output,
89− int size_input, int size_I, int size_PT,
90− const SwsColorMap *map);
88+int ff_sws_color_map_generate_dynamic(v3u16_t *input, v3u16_t *output,
89+ int size_input, int size_I, int size_PT,
90+ const SwsColorMap *map);
9191
9292 /**
9393 * 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
100100 *
101101 * Returns 0 on success, or a negative error code on failure.
102102 */
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);
104104
105105 #endif // SWSCALE_GAMUT_MAPPING_H
libswscale/graph.c+25−25
@@ -472,7 +472,7 @@ static int add_legacy_sws_pass(SwsGraph *graph, SwsFormat src, SwsFormat dst, · 471 unmodified lines
472472 static void free_lut3d(void *priv)
473473 {
474474 SwsLut3D *lut = priv;
475− sws_lut3d_free(&lut);
475+ ff_sws_lut3d_free(&lut);
476476 }
477477
478478 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
480480 SwsLut3D *lut = pass->priv;
481481
482482 /* 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);
484484 }
485485
486486 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
490490 const SwsImg in = shift_img(in_base, y);
491491 const SwsImg out = shift_img(out_base, y);
492492
493− sws_lut3d_apply(lut, in.data[0], in.linesize[0], out.data[0],
494− out.linesize[0], pass->width, h);
493+ ff_sws_lut3d_apply(lut, in.data[0], in.linesize[0], out.data[0],
494+ out.linesize[0], pass->width, h);
495495 }
496496
497497 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
522522 map.src = src.color;
523523 map.dst = dst.color;
524524
525− if (sws_color_map_noop(&map))
525+ if (ff_sws_color_map_noop(&map))
526526 return 0;
527527
528− lut = sws_lut3d_alloc();
528+ lut = ff_sws_lut3d_alloc();
529529 if (!lut)
530530 return AVERROR(ENOMEM);
531531
532− fmt_in = sws_lut3d_pick_pixfmt(src, 0);
533− fmt_out = sws_lut3d_pick_pixfmt(dst, 1);
532+ fmt_in = ff_sws_lut3d_pick_pixfmt(src, 0);
533+ fmt_out = ff_sws_lut3d_pick_pixfmt(dst, 1);
534534 if (fmt_in != src.format) {
535535 SwsFormat tmp = src;
536536 tmp.format = fmt_in;
@@ -539,16 +539,16 @@ static int adapt_colors(SwsGraph *graph, SwsFormat src, SwsFormat dst, · 2 unmodified lines
539539 return ret;
540540 }
541541
542− ret = sws_lut3d_generate(lut, fmt_in, fmt_out, &map);
542+ ret = ff_sws_lut3d_generate(lut, fmt_in, fmt_out, &map);
543543 if (ret < 0) {
544− sws_lut3d_free(&lut);
544+ ff_sws_lut3d_free(&lut);
545545 return ret;
546546 }
547547
548548 pass = pass_add(graph, lut, fmt_out, src.width, src.height,
549549 input, 1, run_lut3d);
550550 if (!pass) {
551− sws_lut3d_free(&lut);
551+ ff_sws_lut3d_free(&lut);
552552 return AVERROR(ENOMEM);
553553 }
554554 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
607607 pass->run(output, input, slice_y, slice_h, pass);
608608 }
609609
610−int sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src,
611− int field, SwsGraph **out_graph)
610+int ff_sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src,
611+ int field, SwsGraph **out_graph)
612612 {
613613 int ret;
614614 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
641641 return 0;
642642
643643 error:
644− sws_graph_free(&graph);
644+ ff_sws_graph_free(&graph);
645645 return ret;
646646 }
647647
648−void sws_graph_free(SwsGraph **pgraph)
648+void ff_sws_graph_free(SwsGraph **pgraph)
649649 {
650650 SwsGraph *graph = *pgraph;
651651 if (!graph)
@@ -684,23 +684,23 @@ static int opts_equal(const SwsContext *c1, const SwsContext *c2) · 32 unmodified lines
684684
685685 }
686686
687−int sws_graph_reinit(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src,
688− int field, SwsGraph **out_graph)
687+int ff_sws_graph_reinit(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src,
688+ int field, SwsGraph **out_graph)
689689 {
690690 SwsGraph *graph = *out_graph;
691691 if (graph && ff_fmt_equal(&graph->src, src) &&
692692 ff_fmt_equal(&graph->dst, dst) &&
693693 opts_equal(ctx, &graph->opts_copy))
694694 {
695− sws_graph_update_metadata(graph, &src->color);
695+ ff_sws_graph_update_metadata(graph, &src->color);
696696 return 0;
697697 }
698698
699− sws_graph_free(out_graph);
700− return sws_graph_create(ctx, dst, src, field, out_graph);
699+ ff_sws_graph_free(out_graph);
700+ return ff_sws_graph_create(ctx, dst, src, field, out_graph);
701701 }
702702
703−void sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color)
703+void ff_sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color)
704704 {
705705 if (!color)
706706 return;
@@ -708,10 +708,10 @@ void sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color) · 1 unmodified line
708708 ff_color_update_dynamic(&graph->src.color, color);
709709 }
710710
711−void sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4],
712− const int out_linesize[4],
713− const uint8_t *const in_data[4],
714− const int in_linesize[4])
711+void ff_sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4],
712+ const int out_linesize[4],
713+ const uint8_t *const in_data[4],
714+ const int in_linesize[4])
715715 {
716716 SwsImg *out = &graph->exec.output;
717717 SwsImg *in = &graph->exec.input;
libswscale/graph.h+12−12
@@ -114,7 +114,7 @@ typedef struct SwsGraph { · 113 unmodified lines
114114 SwsFormat src, dst;
115115 int field;
116116
117− /** Temporary execution state inside sws_graph_run */
117+ /** Temporary execution state inside ff_sws_graph_run */
118118 struct {
119119 const SwsPass *pass; /* current filter pass */
120120 SwsImg input;
@@ -125,34 +125,34 @@ typedef struct SwsGraph { · 4 unmodified lines
125125 /**
126126 * Allocate and initialize the filter graph. Returns 0 or a negative error.
127127 */
128−int sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src,
129− int field, SwsGraph **out_graph);
128+int ff_sws_graph_create(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src,
129+ int field, SwsGraph **out_graph);
130130
131131 /**
132132 * Uninitialize any state associate with this filter graph and free it.
133133 */
134−void sws_graph_free(SwsGraph **graph);
134+void ff_sws_graph_free(SwsGraph **graph);
135135
136136 /**
137137 * Update dynamic per-frame HDR metadata without requiring a full reinit.
138138 */
139−void sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color);
139+void ff_sws_graph_update_metadata(SwsGraph *graph, const SwsColor *color);
140140
141141 /**
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
143143 * format is compatible. This will also update dynamic per-frame metadata.
144144 * Must be called after changing any of the fields in `ctx`, or else they will
145145 * have no effect.
146146 */
147−int sws_graph_reinit(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src,
148− int field, SwsGraph **graph);
147+int ff_sws_graph_reinit(SwsContext *ctx, const SwsFormat *dst, const SwsFormat *src,
148+ int field, SwsGraph **graph);
149149
150150 /**
151151 * Dispatch the filter graph on a single field. Internally threaded.
152152 */
153−void sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4],
154− const int out_linesize[4],
155− const uint8_t *const in_data[4],
156− const int in_linesize[4]);
153+void ff_sws_graph_run(SwsGraph *graph, uint8_t *const out_data[4],
154+ const int out_linesize[4],
155+ const uint8_t *const in_data[4],
156+ const int in_linesize[4]);
157157
158158 #endif /* SWSCALE_GRAPH_H */
libswscale/lut3d.c+14−14
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include "csputils.h"
3030 #include "lut3d.h"
3131
32−SwsLut3D *sws_lut3d_alloc(void)
32+SwsLut3D *ff_sws_lut3d_alloc(void)
3333 {
3434 SwsLut3D *lut3d = av_malloc(sizeof(*lut3d));
3535 if (!lut3d)
@@ -39,17 +39,17 @@ SwsLut3D *sws_lut3d_alloc(void) · 3 unmodified lines
3939 return lut3d;
4040 }
4141
42−void sws_lut3d_free(SwsLut3D **plut3d)
42+void ff_sws_lut3d_free(SwsLut3D **plut3d)
4343 {
4444 av_freep(plut3d);
4545 }
4646
47−bool sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output)
47+bool ff_sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output)
4848 {
4949 return fmt == AV_PIX_FMT_RGBA64;
5050 }
5151
52−enum AVPixelFormat sws_lut3d_pick_pixfmt(SwsFormat fmt, int output)
52+enum AVPixelFormat ff_sws_lut3d_pick_pixfmt(SwsFormat fmt, int output)
5353 {
5454 return AV_PIX_FMT_RGBA64;
5555 }
@@ -221,19 +221,19 @@ static av_always_inline v3u16_t apply_tone_map(const SwsLut3D *lut3d, v3u16_t ip · 165 unmodified lines
221221 return ipt;
222222 }
223223
224−int sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in,
225− enum AVPixelFormat fmt_out, const SwsColorMap *map)
224+int ff_sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in,
225+ enum AVPixelFormat fmt_out, const SwsColorMap *map)
226226 {
227227 int ret;
228228
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))
230230 return AVERROR(EINVAL);
231231
232232 lut3d->dynamic = map->src.frame_peak.num > 0;
233233 lut3d->map = *map;
234234
235235 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],
237237 &lut3d->output[0][0][0],
238238 INPUT_LUT_SIZE, OUTPUT_LUT_SIZE_I,
239239 OUTPUT_LUT_SIZE_PT, map);
@@ -241,15 +241,15 @@ int sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in, · 1 unmodified line
241241 return ret;
242242
243243 /* Make sure initial state is valid */
244− sws_lut3d_update(lut3d, &map->src);
244+ ff_sws_lut3d_update(lut3d, &map->src);
245245 return 0;
246246 } 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],
248248 INPUT_LUT_SIZE, map);
249249 }
250250 }
251251
252−void sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src)
252+void ff_sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src)
253253 {
254254 if (!new_src || !lut3d->dynamic)
255255 return;
@@ -257,11 +257,11 @@ void sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src) · 1 unmodified line
257257 lut3d->map.src.frame_peak = new_src->frame_peak;
258258 lut3d->map.src.frame_avg = new_src->frame_avg;
259259
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);
261261 }
262262
263−void sws_lut3d_apply(const SwsLut3D *lut3d, const uint8_t *in, int in_stride,
264− uint8_t *out, int out_stride, int w, int h)
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)
265265 {
266266 while (h--) {
267267 const uint16_t *in16 = (const uint16_t *) in;
libswscale/lut3d.h+11−11
@@ -59,40 +59,40 @@ typedef struct SwsLut3D { · 58 unmodified lines
5959 v2u16_t tone_map[TONE_LUT_SIZE]; /* new luma, desaturation */
6060 } SwsLut3D;
6161
62−SwsLut3D *sws_lut3d_alloc(void);
63−void sws_lut3d_free(SwsLut3D **lut3d);
62+SwsLut3D *ff_sws_lut3d_alloc(void);
63+void ff_sws_lut3d_free(SwsLut3D **lut3d);
6464
6565 /**
6666 * Test to see if a given format is supported by the 3DLUT input/output code.
6767 */
68−bool sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output);
68+bool ff_sws_lut3d_test_fmt(enum AVPixelFormat fmt, int output);
6969
7070 /**
7171 * Pick the best compatible pixfmt for a given SwsFormat.
7272 */
73−enum AVPixelFormat sws_lut3d_pick_pixfmt(SwsFormat fmt, int output);
73+enum AVPixelFormat ff_sws_lut3d_pick_pixfmt(SwsFormat fmt, int output);
7474
7575 /**
7676 * Recalculate the (static) 3DLUT state with new settings. This will recompute
7777 * everything. To only update per-frame tone mapping state, instead call
78− * sws_lut3d_update().
78+ * ff_sws_lut3d_update().
7979 *
8080 * Returns 0 or a negative error code.
8181 */
82−int sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in,
83− enum AVPixelFormat fmt_out, const SwsColorMap *map);
82+int ff_sws_lut3d_generate(SwsLut3D *lut3d, enum AVPixelFormat fmt_in,
83+ enum AVPixelFormat fmt_out, const SwsColorMap *map);
8484
8585 /**
8686 * Update the tone mapping state. This will only use per-frame metadata. The
8787 * static metadata is ignored.
8888 */
89−void sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src);
89+void ff_sws_lut3d_update(SwsLut3D *lut3d, const SwsColor *new_src);
9090
9191 /**
9292 * 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().
9494 */
95−void sws_lut3d_apply(const SwsLut3D *lut3d, const uint8_t *in, int in_stride,
96− uint8_t *out, int out_stride, int w, int h);
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);
9797
9898 #endif /* SWSCALE_LUT3D_H */
libswscale/swscale.c+4−4
@@ -1403,7 +1403,7 @@ int sws_scale_frame(SwsContext *sws, AVFrame *dst, const AVFrame *src) · 1402 unmodified lines
14031403 int dst_linesize[4], src_linesize[4];
14041404 get_frame_pointers(dst, dst_data, dst_linesize, field);
14051405 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,
14071407 (const uint8_t **) src_data, src_linesize);
14081408 if (!graph->dst.interlaced)
14091409 break;
@@ -1461,7 +1461,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src) · 51 unmodified lines
14611461 goto fail;
14621462 }
14631463
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]);
14651465 if (ret < 0) {
14661466 err_msg = "Failed initializing scaling graph";
14671467 goto fail;
@@ -1474,7 +1474,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src) · 6 unmodified lines
14741474 }
14751475
14761476 if (!src_fmt.interlaced) {
1477− sws_graph_free(&s->graph[FIELD_BOTTOM]);
1477+ ff_sws_graph_free(&s->graph[FIELD_BOTTOM]);
14781478 break;
14791479 }
14801480
@@ -1490,7 +1490,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src) · 9 unmodified lines
14901490 av_color_primaries_name(dst_fmt.color.prim), av_color_transfer_name(dst_fmt.color.trc));
14911491
14921492 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]);
14941494
14951495 return ret;
14961496 }
libswscale/utils.c+1−1
@@ -2480,7 +2480,7 @@ void sws_freeContext(SwsContext *sws) · 2479 unmodified lines
24802480 return;
24812481
24822482 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]);
24842484
24852485 for (i = 0; i < c->nb_slice_ctx; i++)
24862486 sws_freeContext(c->slice_ctx[i]);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t