1 /* 2 * Copyright (c) 2013 Clément Bœsch 3 * Copyright (c) 2018 Paul B Mahol 4 * 5 * This file is part of FFmpeg. 6 * 7 * FFmpeg is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * FFmpeg is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with FFmpeg; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 #ifndef AVFILTER_LUT3D_H 22 #define AVFILTER_LUT3D_H 23 24 #include "config_components.h" 25 26 #include "libavutil/pixdesc.h" 27 #include "framesync.h" 28 #include "avfilter.h" 29 30 enum interp_mode { 31 INTERPOLATE_NEAREST, 32 INTERPOLATE_TRILINEAR, 33 INTERPOLATE_TETRAHEDRAL, 34 INTERPOLATE_PYRAMID, 35 INTERPOLATE_PRISM, 36 NB_INTERP_MODE 37 }; 38 39 struct rgbvec { 40 float r, g, b; 41 }; 42 43 /* 3D LUT don't often go up to level 32, but it is common to have a Hald CLUT 44 * of 512x512 (64x64x64) */ 45 #define MAX_LEVEL 256 46 #define PRELUT_SIZE 65536 47 48 typedef struct Lut3DPreLut { 49 int size; 50 float min[3]; 51 float max[3]; 52 float scale[3]; 53 float* lut[3]; 54 } Lut3DPreLut; 55 56 typedef struct LUT3DContext { 57 const AVClass *class; 58 struct rgbvec *lut; 59 int lutsize; 60 int lutsize2; 61 struct rgbvec scale; 62 int interpolation; ///<interp_mode 63 char *file; 64 uint8_t rgba_map[4]; 65 int step; 66 avfilter_action_func *interp; 67 Lut3DPreLut prelut; 68 #if CONFIG_HALDCLUT_FILTER 69 int clut; 70 int got_clut; 71 uint8_t clut_rgba_map[4]; 72 int clut_step; 73 int clut_bits; 74 int clut_planar; 75 int clut_float; 76 int clut_width; 77 FFFrameSync fs; 78 #endif 79 } LUT3DContext; 80 81 typedef struct ThreadData { 82 AVFrame *in, *out; 83 } ThreadData; 84 85 void ff_lut3d_init_x86(LUT3DContext *s, const AVPixFmtDescriptor *desc); 86 87 #endif /* AVFILTER_LUT3D_H */ 88