Lines Matching defs:lut3d
105 #define NEXT(x) (FFMIN((int)(x) + 1, lut3d->lutsize - 1))
110 static inline struct rgbvec interp_nearest(const LUT3DContext *lut3d,
113 return lut3d->lut[NEAR(s->r)][NEAR(s->g)][NEAR(s->b)];
120 static inline struct rgbvec interp_trilinear(const LUT3DContext *lut3d,
126 const struct rgbvec c000 = lut3d->lut[prev[0]][prev[1]][prev[2]];
127 const struct rgbvec c001 = lut3d->lut[prev[0]][prev[1]][next[2]];
128 const struct rgbvec c010 = lut3d->lut[prev[0]][next[1]][prev[2]];
129 const struct rgbvec c011 = lut3d->lut[prev[0]][next[1]][next[2]];
130 const struct rgbvec c100 = lut3d->lut[next[0]][prev[1]][prev[2]];
131 const struct rgbvec c101 = lut3d->lut[next[0]][prev[1]][next[2]];
132 const struct rgbvec c110 = lut3d->lut[next[0]][next[1]][prev[2]];
133 const struct rgbvec c111 = lut3d->lut[next[0]][next[1]][next[2]];
148 static inline struct rgbvec interp_tetrahedral(const LUT3DContext *lut3d,
154 const struct rgbvec c000 = lut3d->lut[prev[0]][prev[1]][prev[2]];
155 const struct rgbvec c111 = lut3d->lut[next[0]][next[1]][next[2]];
159 const struct rgbvec c100 = lut3d->lut[next[0]][prev[1]][prev[2]];
160 const struct rgbvec c110 = lut3d->lut[next[0]][next[1]][prev[2]];
165 const struct rgbvec c100 = lut3d->lut[next[0]][prev[1]][prev[2]];
166 const struct rgbvec c101 = lut3d->lut[next[0]][prev[1]][next[2]];
171 const struct rgbvec c001 = lut3d->lut[prev[0]][prev[1]][next[2]];
172 const struct rgbvec c101 = lut3d->lut[next[0]][prev[1]][next[2]];
179 const struct rgbvec c001 = lut3d->lut[prev[0]][prev[1]][next[2]];
180 const struct rgbvec c011 = lut3d->lut[prev[0]][next[1]][next[2]];
185 const struct rgbvec c010 = lut3d->lut[prev[0]][next[1]][prev[2]];
186 const struct rgbvec c011 = lut3d->lut[prev[0]][next[1]][next[2]];
191 const struct rgbvec c010 = lut3d->lut[prev[0]][next[1]][prev[2]];
192 const struct rgbvec c110 = lut3d->lut[next[0]][next[1]][prev[2]];
205 const LUT3DContext *lut3d = ctx->priv; \
210 const int step = lut3d->step; \
211 const uint8_t r = lut3d->rgba_map[R]; \
212 const uint8_t g = lut3d->rgba_map[G]; \
213 const uint8_t b = lut3d->rgba_map[B]; \
214 const uint8_t a = lut3d->rgba_map[A]; \
219 const float scale = (1. / ((1<<nbits) - 1)) * (lut3d->lutsize - 1); \
228 struct rgbvec vec = interp_##name(lut3d, &scaled_rgb); \
269 LUT3DContext *lut3d = ctx->priv;
273 lut3d->lutsize = size = 33;
282 lut3d->lutsize = size;
288 struct rgbvec *vec = &lut3d->lut[k][j][i];
302 LUT3DContext *lut3d = ctx->priv;
316 lut3d->lutsize = size;
320 struct rgbvec *vec = &lut3d->lut[i][j][k];
355 LUT3DContext *lut3d = ctx->priv;
360 lut3d->lutsize = size;
366 struct rgbvec *vec = &lut3d->lut[k][j][i];
383 LUT3DContext *lut3d = ctx->priv;
423 lut3d->lutsize = size;
429 struct rgbvec *vec = &lut3d->lut[k][j][i];
444 static void set_identity_matrix(LUT3DContext *lut3d, int size)
449 lut3d->lutsize = size;
453 struct rgbvec *vec = &lut3d->lut[k][j][i];
481 LUT3DContext *lut3d = inlink->dst->priv;
492 ff_fill_rgba_map(lut3d->rgba_map, inlink->format);
493 lut3d->step = av_get_padded_bits_per_pixel(desc) >> (3 + is16bit);
496 if (is16bit) lut3d->interp = interp_16_##name; \
497 else lut3d->interp = interp_8_##name; \
500 switch (lut3d->interpolation) {
514 LUT3DContext *lut3d = ctx->priv;
532 ctx->internal->execute(ctx, lut3d->interp, &td, NULL, FFMIN(outlink->h, ctx->graph->nb_threads));
555 AVFILTER_DEFINE_CLASS(lut3d);
562 LUT3DContext *lut3d = ctx->priv;
564 if (!lut3d->file) {
565 set_identity_matrix(lut3d, 32);
569 f = fopen(lut3d->file, "r");
572 av_log(ctx, AV_LOG_ERROR, "%s: %s\n", lut3d->file, av_err2str(ret));
576 ext = strrchr(lut3d->file, '.');
597 if (!ret && !lut3d->lutsize) {
626 .name = "lut3d",
640 static void update_clut(LUT3DContext *lut3d, const AVFrame *frame)
644 const int w = lut3d->clut_width;
645 const int step = lut3d->clut_step;
646 const uint8_t *rgba_map = lut3d->clut_rgba_map;
647 const int level = lut3d->lutsize;
657 struct rgbvec *vec = &lut3d->lut[i][j][k]; \
670 if (!lut3d->clut_is16bit) LOAD_CLUT(8);
678 LUT3DContext *lut3d = ctx->priv;
684 if ((ret = ff_dualinput_init(ctx, &lut3d->dinput)) < 0)
705 LUT3DContext *lut3d = ctx->priv;
708 lut3d->clut_is16bit = 0;
714 lut3d->clut_is16bit = 1;
717 lut3d->clut_step = av_get_padded_bits_per_pixel(desc) >> 3;
718 ff_fill_rgba_map(lut3d->clut_rgba_map, inlink->format);
726 lut3d->clut_width = w = h = FFMIN(inlink->w, inlink->h);
744 lut3d->lutsize = level;
759 LUT3DContext *lut3d = ctx->priv;
760 lut3d->dinput.process = update_apply_clut;
766 LUT3DContext *lut3d = ctx->priv;
767 ff_dualinput_uninit(&lut3d->dinput);