[FFmpeg-cvslog] lavfi/curves: move alloc and init of LUTs inside config_input()
Clément Bœsch
git at videolan.org
Sun Jul 24 13:20:45 EEST 2016
ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Jul 24 11:13:29 2016 +0200| [f19f5b906d706d4c4d55e5588668956ea288f433] | committer: Clément Bœsch
lavfi/curves: move alloc and init of LUTs inside config_input()
This is needed in order to have different sizes of LUTs according to the
input.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f19f5b906d706d4c4d55e5588668956ea288f433
---
libavfilter/vf_curves.c | 61 +++++++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 29 deletions(-)
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 85bffb1..9ab6f73 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -440,9 +440,8 @@ static int dump_curves(const char *fname, uint8_t *graph[NB_COMP + 1],
static av_cold int init(AVFilterContext *ctx)
{
- int i, j, ret;
+ int i, ret;
CurvesContext *curves = ctx->priv;
- struct keypoint *comp_points[NB_COMP + 1] = {0};
char **pts = curves->comp_points_str;
const char *allp = curves->comp_points_str_all;
@@ -478,6 +477,37 @@ static av_cold int init(AVFilterContext *ctx)
SET_COMP_IF_NOT_SET(3, master);
}
+ return 0;
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
+ AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
+ AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR,
+ AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
+ AV_PIX_FMT_NONE
+ };
+ AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
+ if (!fmts_list)
+ return AVERROR(ENOMEM);
+ return ff_set_common_formats(ctx, fmts_list);
+}
+
+static int config_input(AVFilterLink *inlink)
+{
+ int i, j, ret;
+ AVFilterContext *ctx = inlink->dst;
+ CurvesContext *curves = ctx->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+ char **pts = curves->comp_points_str;
+ struct keypoint *comp_points[NB_COMP + 1] = {0};
+
+ ff_fill_rgba_map(curves->rgba_map, inlink->format);
+ curves->step = av_get_padded_bits_per_pixel(desc) >> 3;
+
for (i = 0; i < NB_COMP + 1; i++) {
curves->graph[i] = av_mallocz(256);
if (!curves->graph[i])
@@ -522,33 +552,6 @@ static av_cold int init(AVFilterContext *ctx)
return 0;
}
-static int query_formats(AVFilterContext *ctx)
-{
- static const enum AVPixelFormat pix_fmts[] = {
- AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
- AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
- AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
- AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR,
- AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
- AV_PIX_FMT_NONE
- };
- AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
-}
-
-static int config_input(AVFilterLink *inlink)
-{
- CurvesContext *curves = inlink->dst->priv;
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
-
- ff_fill_rgba_map(curves->rgba_map, inlink->format);
- curves->step = av_get_padded_bits_per_pixel(desc) >> 3;
-
- return 0;
-}
-
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
int x, y;
More information about the ffmpeg-cvslog
mailing list