static int parse_cube(AVFilterContext *ctx, FILE *f)

{

    LUT3DContext *lut3d = ctx->priv;

    char line[MAX_LINE_SIZE];

    float min[3] = {0.0, 0.0, 0.0};

    float max[3] = {1.0, 1.0, 1.0};



    while (fgets(line, sizeof(line), f)) {

        if (!strncmp(line, "LUT_3D_SIZE ", 12)) {

            int i, j, k;

            const int size = strtol(line + 12, NULL, 0);



            if (size > MAX_LEVEL) {

                av_log(ctx, AV_LOG_ERROR, "Too large 3D LUT\n");

                return AVERROR(EINVAL);

            }

            lut3d->lutsize = size;

            for (k = 0; k < size; k++) {

                for (j = 0; j < size; j++) {

                    for (i = 0; i < size; i++) {

                        struct rgbvec *vec = &lut3d->lut[k][j][i];



                        do {

                            NEXT_LINE(0);

                            if (!strncmp(line, "DOMAIN_", 7)) {

                                float *vals = NULL;

                                if      (!strncmp(line + 7, "MIN ", 4)) vals = min;

                                else if (!strncmp(line + 7, "MAX ", 4)) vals = max;

                                if (!vals)

                                    return AVERROR_INVALIDDATA;

                                sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2);

                                av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n",

                                       min[0], min[1], min[2], max[0], max[1], max[2]);

                                continue;

                            }

                        } while (skip_line(line));

                        if (sscanf(line, "%f %f %f", &vec->r, &vec->g, &vec->b) != 3)

                            return AVERROR_INVALIDDATA;

                        vec->r *= max[0] - min[0];

                        vec->g *= max[1] - min[1];

                        vec->b *= max[2] - min[2];

                    }

                }

            }

            break;

        }

    }

    return 0;

}

static int parse_cube(AVFilterContext *ctx, FILE *f)

{

    LUT3DContext *lut3d = ctx->priv;

    char line[MAX_LINE_SIZE];

    float min[3] = {0.0, 0.0, 0.0};

    float max[3] = {1.0, 1.0, 1.0};



    while (fgets(line, sizeof(line), f)) {

        if (!strncmp(line, "LUT_3D_SIZE ", 12)) {

            int i, j, k;

            const int size = strtol(line + 12, NULL, 0);



            if (size > MAX_LEVEL) {

                av_log(ctx, AV_LOG_ERROR, "Too large 3D LUT\n");

                return AVERROR(EINVAL);

            }

            lut3d->lutsize = size;

            for (k = 0; k < size; k++) {

                for (j = 0; j < size; j++) {

                    for (i = 0; i < size; i++) {

                        struct rgbvec *vec = &lut3d->lut[k][j][i];



                        do {

                            NEXT_LINE(0);

                            if (!strncmp(line, "DOMAIN_", 7)) {

                                float *vals = NULL;

                                if      (!strncmp(line + 7, "MIN ", 4)) vals = min;

                                else if (!strncmp(line + 7, "MAX ", 4)) vals = max;

                                if (!vals)

                                    return AVERROR_INVALIDDATA;

                                sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2);

                                av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n",

                                       min[0], min[1], min[2], max[0], max[1], max[2]);

                                continue;

                            }

                        } while (skip_line(line));

                        if (sscanf(line, "%f %f %f", &vec->r, &vec->g, &vec->b) != 3)

                            return AVERROR_INVALIDDATA;

                        vec->r *= max[0] - min[0];

                        vec->g *= max[1] - min[1];

                        vec->b *= max[2] - min[2];

                    }

                }

            }

            break;

        }

    }

    return 0;

}

            if (size > MAX_LEVEL) {                 av_log(ctx, AV_LOG_ERROR, "Too large 3D LUT\n");
static int FUNC_0(AVFilterContext *VAR_0, FILE *VAR_1)

{

    LUT3DContext *lut3d = VAR_0->priv;

    char VAR_2[MAX_LINE_SIZE];

    float VAR_3[3] = {0.0, 0.0, 0.0};

    float VAR_4[3] = {1.0, 1.0, 1.0};



    while (fgets(VAR_2, sizeof(VAR_2), VAR_1)) {

        if (!strncmp(VAR_2, "LUT_3D_SIZE ", 12)) {

            int VAR_5, VAR_6, VAR_7;

            const int VAR_8 = strtol(VAR_2 + 12, NULL, 0);



            if (VAR_8 > MAX_LEVEL) {

                av_log(VAR_0, AV_LOG_ERROR, "Too large 3D LUT\n");

                return AVERROR(EINVAL);

            }

            lut3d->lutsize = VAR_8;

            for (VAR_7 = 0; VAR_7 < VAR_8; VAR_7++) {

                for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {

                    for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++) {

                        struct rgbvec *VAR_9 = &lut3d->lut[VAR_7][VAR_6][VAR_5];



                        do {

                            NEXT_LINE(0);

                            if (!strncmp(VAR_2, "DOMAIN_", 7)) {

                                float *VAR_10 = NULL;

                                if      (!strncmp(VAR_2 + 7, "MIN ", 4)) VAR_10 = VAR_3;

                                else if (!strncmp(VAR_2 + 7, "MAX ", 4)) VAR_10 = VAR_4;

                                if (!VAR_10)

                                    return AVERROR_INVALIDDATA;

                                sscanf(VAR_2 + 11, "%VAR_1 %VAR_1 %VAR_1", VAR_10, VAR_10 + 1, VAR_10 + 2);

                                av_log(VAR_0, AV_LOG_DEBUG, "VAR_3: %VAR_1 %VAR_1 %VAR_1 | VAR_4: %VAR_1 %VAR_1 %VAR_1\n",

                                       VAR_3[0], VAR_3[1], VAR_3[2], VAR_4[0], VAR_4[1], VAR_4[2]);

                                continue;

                            }

                        } while (skip_line(VAR_2));

                        if (sscanf(VAR_2, "%VAR_1 %VAR_1 %VAR_1", &VAR_9->r, &VAR_9->g, &VAR_9->b) != 3)

                            return AVERROR_INVALIDDATA;

                        VAR_9->r *= VAR_4[0] - VAR_3[0];

                        VAR_9->g *= VAR_4[1] - VAR_3[1];

                        VAR_9->b *= VAR_4[2] - VAR_3[2];

                    }

                }

            }

            break;

        }

    }

    return 0;

}

static int FUNC_0(AVFilterContext *VAR_0, FILE *VAR_1)
{ LUT3DContext *lut3d = VAR_0->priv; char VAR_2[MAX_LINE_SIZE]; float VAR_3[3] = {0.0, 0.0, 0.0}; float VAR_4[3] = {1.0, 1.0, 1.0}; while (fgets(VAR_2, sizeof(VAR_2), VAR_1)) { if (!strncmp(VAR_2, "LUT_3D_SIZE ", 12)) { int VAR_5, VAR_6, VAR_7; const int VAR_8 = strtol(VAR_2 + 12, NULL, 0); if (VAR_8 > MAX_LEVEL) { av_log(VAR_0, AV_LOG_ERROR, "Too large 3D LUT\n"); return AVERROR(EINVAL); } lut3d->lutsize = VAR_8; for (VAR_7 = 0; VAR_7 < VAR_8; VAR_7++) { for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) { for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++) { struct rgbvec *VAR_9 = &lut3d->lut[VAR_7][VAR_6][VAR_5]; do { NEXT_LINE(0); if (!strncmp(VAR_2, "DOMAIN_", 7)) { float *VAR_10 = NULL; if      (!strncmp(VAR_2 + 7, "MIN ", 4)) VAR_10 = VAR_3; else if (!strncmp(VAR_2 + 7, "MAX ", 4)) VAR_10 = VAR_4; if (!VAR_10)
return AVERROR_INVALIDDATA; sscanf(VAR_2 + 11, "%VAR_1 %VAR_1 %VAR_1", VAR_10, VAR_10 + 1, VAR_10 + 2); av_log(VAR_0, AV_LOG_DEBUG, "VAR_3: %VAR_1 %VAR_1 %VAR_1 | VAR_4: %VAR_1 %VAR_1 %VAR_1\n",
VAR_3[0], VAR_3[1], VAR_3[2], VAR_4[0], VAR_4[1], VAR_4[2]); continue; } } while (skip_line(VAR_2)); if (sscanf(VAR_2, "%VAR_1 %VAR_1 %VAR_1", &VAR_9->r, &VAR_9->g, &VAR_9->b) != 3)
return AVERROR_INVALIDDATA; VAR_9->r *= VAR_4[0] - VAR_3[0]; VAR_9->g *= VAR_4[1] - VAR_3[1]; VAR_9->b *= VAR_4[2] - VAR_3[2]; } } } break; } } return 0; }