68 #if CONFIG_HALDCLUT_FILTER
81 #define OFFSET(x) offsetof(LUT3DContext, x)
82 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
83 #define COMMON_OPTIONS \
84 { "interp", "select interpolation mode", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERPOLATE_TETRAHEDRAL}, 0, NB_INTERP_MODE-1, FLAGS, "interp_mode" }, \
85 { "nearest", "use values from the nearest defined points", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_NEAREST}, INT_MIN, INT_MAX, FLAGS, "interp_mode" }, \
86 { "trilinear", "interpolate values using the 8 points defining a cube", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_TRILINEAR}, INT_MIN, INT_MAX, FLAGS, "interp_mode" }, \
87 { "tetrahedral", "interpolate values using a tetrahedron", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_TETRAHEDRAL}, INT_MIN, INT_MAX, FLAGS, "interp_mode" }, \
90 static inline float lerpf(
float v0,
float v1,
float f)
92 return v0 + (v1 -
v0) * f;
103 #define NEAR(x) ((int)((x) + .5))
104 #define PREV(x) ((int)(x))
105 #define NEXT(x) (FFMIN((int)(x) + 1, lut3d->lutsize - 1))
125 const struct rgbvec d = {
s->r - prev[0],
s->g - prev[1],
s->b - prev[2]};
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]];
153 const struct rgbvec d = {
s->r - prev[0],
s->g - prev[1],
s->b - prev[2]};
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]];
161 c.
r = (1-d.
r) * c000.
r + (d.
r-d.
g) * c100.
r + (d.
g-d.
b) * c110.
r + (d.
b) * c111.
r;
162 c.
g = (1-d.
r) * c000.
g + (d.
r-d.
g) * c100.
g + (d.
g-d.
b) * c110.
g + (d.
b) * c111.
g;
163 c.
b = (1-d.
r) * c000.
b + (d.
r-d.
g) * c100.
b + (d.
g-d.
b) * c110.
b + (d.
b) * c111.
b;
164 }
else if (d.
r > d.
b) {
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]];
167 c.
r = (1-d.
r) * c000.
r + (d.
r-d.
b) * c100.
r + (d.
b-d.
g) * c101.
r + (d.
g) * c111.
r;
168 c.
g = (1-d.
r) * c000.
g + (d.
r-d.
b) * c100.
g + (d.
b-d.
g) * c101.
g + (d.
g) * c111.
g;
169 c.
b = (1-d.
r) * c000.
b + (d.
r-d.
b) * c100.
b + (d.
b-d.
g) * c101.
b + (d.
g) * c111.
b;
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]];
173 c.
r = (1-d.
b) * c000.
r + (d.
b-d.
r) * c001.
r + (d.
r-d.
g) * c101.
r + (d.
g) * c111.
r;
174 c.
g = (1-d.
b) * c000.
g + (d.
b-d.
r) * c001.
g + (d.
r-d.
g) * c101.
g + (d.
g) * c111.
g;
175 c.
b = (1-d.
b) * c000.
b + (d.
b-d.
r) * c001.
b + (d.
r-d.
g) * c101.
b + (d.
g) * c111.
b;
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]];
181 c.
r = (1-d.
b) * c000.
r + (d.
b-d.
g) * c001.
r + (d.
g-d.
r) * c011.
r + (d.
r) * c111.
r;
182 c.
g = (1-d.
b) * c000.
g + (d.
b-d.
g) * c001.
g + (d.
g-d.
r) * c011.
g + (d.
r) * c111.
g;
183 c.
b = (1-d.
b) * c000.
b + (d.
b-d.
g) * c001.
b + (d.
g-d.
r) * c011.
b + (d.
r) * c111.
b;
184 }
else if (d.
b > d.
r) {
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]];
187 c.
r = (1-d.
g) * c000.
r + (d.
g-d.
b) * c010.
r + (d.
b-d.
r) * c011.
r + (d.
r) * c111.
r;
188 c.
g = (1-d.
g) * c000.
g + (d.
g-d.
b) * c010.
g + (d.
b-d.
r) * c011.
g + (d.
r) * c111.
g;
189 c.
b = (1-d.
g) * c000.
b + (d.
g-d.
b) * c010.
b + (d.
b-d.
r) * c011.
b + (d.
r) * c111.
b;
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]];
193 c.
r = (1-d.
g) * c000.
r + (d.
g-d.
r) * c010.
r + (d.
r-d.
b) * c110.
r + (d.
b) * c111.
r;
194 c.
g = (1-d.
g) * c000.
g + (d.
g-d.
r) * c010.
g + (d.
r-d.
b) * c110.
g + (d.
b) * c111.
g;
195 c.
b = (1-d.
g) * c000.
b + (d.
g-d.
r) * c010.
b + (d.
r-d.
b) * c110.
b + (d.
b) * c111.
b;
201 #define DEFINE_INTERP_FUNC(name, nbits) \
202 static int interp_##nbits##_##name(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
205 const LUT3DContext *lut3d = ctx->priv; \
206 const ThreadData *td = arg; \
207 const AVFrame *in = td->in; \
208 const AVFrame *out = td->out; \
209 const int direct = out == in; \
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]; \
215 const int slice_start = (in->height * jobnr ) / nb_jobs; \
216 const int slice_end = (in->height * (jobnr+1)) / nb_jobs; \
217 uint8_t *dstrow = out->data[0] + slice_start * out->linesize[0]; \
218 const uint8_t *srcrow = in ->data[0] + slice_start * in ->linesize[0]; \
219 const float scale = (1. / ((1<<nbits) - 1)) * (lut3d->lutsize - 1); \
221 for (y = slice_start; y < slice_end; y++) { \
222 uint##nbits##_t *dst = (uint##nbits##_t *)dstrow; \
223 const uint##nbits##_t *src = (const uint##nbits##_t *)srcrow; \
224 for (x = 0; x < in->width * step; x += step) { \
225 const struct rgbvec scaled_rgb = {src[x + r] * scale, \
226 src[x + g] * scale, \
227 src[x + b] * scale}; \
228 struct rgbvec vec = interp_##name(lut3d, &scaled_rgb); \
229 dst[x + r] = av_clip_uint##nbits(vec.r * (float)((1<<nbits) - 1)); \
230 dst[x + g] = av_clip_uint##nbits(vec.g * (float)((1<<nbits) - 1)); \
231 dst[x + b] = av_clip_uint##nbits(vec.b * (float)((1<<nbits) - 1)); \
232 if (!direct && step == 4) \
233 dst[x + a] = src[x + a]; \
235 dstrow += out->linesize[0]; \
236 srcrow += in ->linesize[0]; \
249 #define MAX_LINE_SIZE 512
255 return !*p || *p ==
'#';
258 #define NEXT_LINE(loop_cond) do { \
259 if (!fgets(line, sizeof(line), f)) { \
260 av_log(ctx, AV_LOG_ERROR, "Unexpected EOF\n"); \
261 return AVERROR_INVALIDDATA; \
276 if (!strncmp(line,
"3DLUTSIZE ", 10)) {
277 size = strtol(line + 10,
NULL, 0);
285 for (k = 0; k <
size; k++) {
286 for (j = 0; j <
size; j++) {
287 for (i = 0; i <
size; i++) {
288 struct rgbvec *vec = &lut3d->
lut[k][j][i];
289 if (k != 0 || j != 0 || i != 0)
291 if (sscanf(line,
"%f %f %f", &vec->
r, &vec->
g, &vec->
b) != 3)
304 float min[3] = {0.0, 0.0, 0.0};
305 float max[3] = {1.0, 1.0, 1.0};
307 while (fgets(line,
sizeof(line), f)) {
308 if (!strncmp(line,
"LUT_3D_SIZE ", 12)) {
310 const int size = strtol(line + 12,
NULL, 0);
317 for (k = 0; k <
size; k++) {
318 for (j = 0; j <
size; j++) {
319 for (i = 0; i <
size; i++) {
320 struct rgbvec *vec = &lut3d->
lut[i][j][k];
325 if (!strncmp(line,
"DOMAIN_", 7)) {
327 if (!strncmp(line + 7,
"MIN ", 4)) vals =
min;
328 else if (!strncmp(line + 7,
"MAX ", 4)) vals = max;
331 sscanf(line + 11,
"%f %f %f", vals, vals + 1, vals + 2);
333 min[0], min[1], min[2], max[0], max[1], max[2]);
337 if (sscanf(line,
"%f %f %f", &vec->
r, &vec->
g, &vec->
b) != 3)
339 vec->
r *= max[0] - min[0];
340 vec->
g *= max[1] - min[1];
341 vec->
b *= max[2] - min[2];
359 const float scale = 16*16*16;
363 for (k = 0; k <
size; k++) {
364 for (j = 0; j <
size; j++) {
365 for (i = 0; i <
size; i++) {
367 struct rgbvec *vec = &lut3d->
lut[k][j][i];
370 if (sscanf(line,
"%d %d %d", &r, &g, &b) != 3)
388 uint8_t rgb_map[3] = {0, 1, 2};
390 while (fgets(line,
sizeof(line), f)) {
391 if (!strncmp(line,
"in", 2)) in = strtol(line + 2,
NULL, 0);
392 else if (!strncmp(line,
"out", 3))
out = strtol(line + 3,
NULL, 0);
393 else if (!strncmp(line,
"values", 6)) {
394 const char *p = line + 6;
395 #define SET_COLOR(id) do { \
396 while (av_isspace(*p)) \
399 case 'r': rgb_map[id] = 0; break; \
400 case 'g': rgb_map[id] = 1; break; \
401 case 'b': rgb_map[id] = 2; break; \
403 while (*p && !av_isspace(*p)) \
413 if (in == -1 ||
out == -1) {
417 if (in < 2 ||
out < 2 ||
423 for (size = 1; size*size*size <
in; size++);
425 scale = 1. / (
out - 1);
427 for (k = 0; k <
size; k++) {
428 for (j = 0; j <
size; j++) {
429 for (i = 0; i <
size; i++) {
430 struct rgbvec *vec = &lut3d->
lut[k][j][i];
434 if (sscanf(line,
"%f %f %f", val, val + 1, val + 2) != 3)
436 vec->
r = val[rgb_map[0]] * scale;
437 vec->
g = val[rgb_map[1]] * scale;
438 vec->
b = val[rgb_map[2]] * scale;
448 const float c = 1. / (size - 1);
451 for (k = 0; k <
size; k++) {
452 for (j = 0; j <
size; j++) {
453 for (i = 0; i <
size; i++) {
454 struct rgbvec *vec = &lut3d->
lut[k][j][i];
498 #define SET_FUNC(name) do { \
499 if (is16bit) lut3d->interp = interp_16_##name; \
500 else lut3d->interp = interp_8_##name; \
552 #if CONFIG_LUT3D_FILTER
553 static const AVOption lut3d_options[] = {
572 f = fopen(lut3d->
file,
"r");
579 ext = strrchr(lut3d->
file,
'.');
636 .priv_class = &lut3d_class,
641 #if CONFIG_HALDCLUT_FILTER
646 const int linesize = frame->
linesize[0];
647 const int w = lut3d->clut_width;
648 const int step = lut3d->clut_step;
649 const uint8_t *rgba_map = lut3d->clut_rgba_map;
652 #define LOAD_CLUT(nbits) do { \
653 int i, j, k, x = 0, y = 0; \
655 for (k = 0; k < level; k++) { \
656 for (j = 0; j < level; j++) { \
657 for (i = 0; i < level; i++) { \
658 const uint##nbits##_t *src = (const uint##nbits##_t *) \
659 (data + y*linesize + x*step); \
660 struct rgbvec *vec = &lut3d->lut[i][j][k]; \
661 vec->r = src[rgba_map[0]] / (float)((1<<(nbits)) - 1); \
662 vec->g = src[rgba_map[1]] / (float)((1<<(nbits)) - 1); \
663 vec->b = src[rgba_map[2]] / (float)((1<<(nbits)) - 1); \
673 if (!lut3d->clut_is16bit) LOAD_CLUT(8);
710 lut3d->clut_is16bit = 0;
716 lut3d->clut_is16bit = 1;
722 if (inlink->
w > inlink->
h)
724 "Hald CLUT will be ignored\n", inlink->
w - inlink->
h);
725 else if (inlink->
w < inlink->
h)
727 "Hald CLUT will be ignored\n", inlink->
h - inlink->
w);
728 lut3d->clut_width = w = h =
FFMIN(inlink->
w, inlink->
h);
730 for (level = 1; level*level*level < w; level++);
731 size = level*level*
level;
739 const int max_clut_level = sqrt(
MAX_LEVEL);
740 const int max_clut_size = max_clut_level*max_clut_level*max_clut_level;
742 "(maximum level is %d, or %dx%d CLUT)\n",
743 max_clut_level, max_clut_size, max_clut_size);
763 update_clut(ctx->
priv, second);
771 lut3d->fs.on_event = update_apply_clut;
781 static const AVOption haldclut_options[] = {
795 .config_props = config_clut,
813 .preinit = haldclut_framesync_preinit,
814 .
init = haldclut_init,
815 .
uninit = haldclut_uninit,
818 .
inputs = haldclut_inputs,
820 .priv_class = &haldclut_class,
const char const char void * val
#define FRAMESYNC_DEFINE_CLASS(name, context, field)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int config_input(AVFilterLink *inlink)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
static struct rgbvec interp_trilinear(const LUT3DContext *lut3d, const struct rgbvec *s)
Interpolate using the 8 vertices of a cube.
ptrdiff_t const GLvoid * data
#define AV_LOG_WARNING
Something somehow does not look correct.
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
static av_cold int init(AVCodecContext *avctx)
#define AV_PIX_FMT_RGBA64
int h
agreed upon image height
static int skip_line(const char *p)
static av_const int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
#define AV_PIX_FMT_BGRA64
static int parse_cube(AVFilterContext *ctx, FILE *f)
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
const char * name
Pad name.
AVFilterContext * parent
Parent filter context.
AVFilterLink ** inputs
array of pointers to input links
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int activate(AVFilterContext *ctx)
static float lerpf(float v0, float v1, float f)
static av_cold int uninit(AVCodecContext *avctx)
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
static av_cold int end(AVCodecContext *avctx)
int ff_framesync_dualinput_get(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
static void set_identity_matrix(LUT3DContext *lut3d, int size)
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
A filter pad used for either input or output.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int( avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A function pointer passed to the AVFilterGraph::execute callback to be executed multiple times...
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
#define DEFINE_INTERP_FUNC(name, nbits)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void * priv
private data for use by the filter
int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel for the pixel format described by pixdesc, including any padding ...
static struct rgbvec interp_nearest(const LUT3DContext *lut3d, const struct rgbvec *s)
Get the nearest defined point.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int config_output(AVFilterLink *outlink)
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int w
agreed upon image width
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
packed RGB 8:8:8, 24bpp, BGRBGR...
AVFilterContext * src
source filter
static const AVFilterPad outputs[]
static AVFrame * apply_lut(AVFilterLink *inlink, AVFrame *in)
int format
agreed upon media format
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
#define AV_LOG_INFO
Standard information.
static const AVFilterPad inputs[]
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static struct rgbvec lerp(const struct rgbvec *v0, const struct rgbvec *v1, float f)
int interpolation
interp_mode
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
Describe the class of an AVClass context structure.
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
const char * name
Filter name.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
static struct rgbvec interp_tetrahedral(const LUT3DContext *lut3d, const struct rgbvec *s)
Tetrahedral interpolation.
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define NEXT_LINE(loop_cond)
static int parse_m3d(AVFilterContext *ctx, FILE *f)
static int parse_3dl(AVFilterContext *ctx, FILE *f)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
avfilter_execute_func * execute
static int parse_dat(AVFilterContext *ctx, FILE *f)
AVFilterContext * dst
dest filter
#define AVFILTER_DEFINE_CLASS(fname)
static int query_formats(AVFilterContext *ctx)
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
AVPixelFormat
Pixel format.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
avfilter_action_func * interp
struct rgbvec lut[MAX_LEVEL][MAX_LEVEL][MAX_LEVEL]