26 #include "libavutil/opt.h"
27 #include "libavutil/file.h"
28 #include "libavutil/intreadwrite.h"
29 #include "libavutil/avassert.h"
30 #include "libavutil/pixdesc.h"
31 #include "libavutil/avstring.h"
70 #if CONFIG_HALDCLUT_FILTER
79 #define OFFSET(x) offsetof(LUT3DContext, x)
80 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
81 #define COMMON_OPTIONS \
82 { "interp", "select interpolation mode", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERPOLATE_TETRAHEDRAL}, 0, NB_INTERP_MODE-1, FLAGS, "interp_mode" }, \
83 { "nearest", "use values from the nearest defined points", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_NEAREST}, INT_MIN, INT_MAX, FLAGS, "interp_mode" }, \
84 { "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" }, \
85 { "tetrahedral", "interpolate values using a tetrahedron", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_TETRAHEDRAL}, INT_MIN, INT_MAX, FLAGS, "interp_mode" }, \
88 static inline float lerpf(
float v0,
float v1,
float f)
90 return v0 + (v1 -
v0) * f;
101 #define NEAR(x) ((int)((x) + .5))
102 #define PREV(x) ((int)(x))
103 #define NEXT(x) (FFMIN((int)(x) + 1, lut3d->lutsize - 1))
123 const struct rgbvec d = {
s->r - prev[0],
s->g - prev[1],
s->b - prev[2]};
124 const struct rgbvec c000 = lut3d->lut[prev[0]][prev[1]][prev[2]];
125 const struct rgbvec c001 = lut3d->lut[prev[0]][prev[1]][next[2]];
126 const struct rgbvec c010 = lut3d->lut[prev[0]][next[1]][prev[2]];
127 const struct rgbvec c011 = lut3d->lut[prev[0]][next[1]][next[2]];
128 const struct rgbvec c100 = lut3d->lut[next[0]][prev[1]][prev[2]];
129 const struct rgbvec c101 = lut3d->lut[next[0]][prev[1]][next[2]];
130 const struct rgbvec c110 = lut3d->lut[next[0]][next[1]][prev[2]];
131 const struct rgbvec c111 = lut3d->lut[next[0]][next[1]][next[2]];
151 const struct rgbvec d = {
s->r - prev[0],
s->g - prev[1],
s->b - prev[2]};
152 const struct rgbvec c000 = lut3d->lut[prev[0]][prev[1]][prev[2]];
153 const struct rgbvec c111 = lut3d->lut[next[0]][next[1]][next[2]];
157 const struct rgbvec c100 = lut3d->lut[next[0]][prev[1]][prev[2]];
158 const struct rgbvec c110 = lut3d->lut[next[0]][next[1]][prev[2]];
159 c.
r = (1-d.
r) * c000.
r + (d.
r-d.
g) * c100.
r + (d.
g-d.
b) * c110.
r + (d.
b) * c111.
r;
160 c.
g = (1-d.
r) * c000.
g + (d.
r-d.
g) * c100.
g + (d.
g-d.
b) * c110.
g + (d.
b) * c111.
g;
161 c.
b = (1-d.
r) * c000.
b + (d.
r-d.
g) * c100.
b + (d.
g-d.
b) * c110.
b + (d.
b) * c111.
b;
162 }
else if (d.
r > d.
b) {
163 const struct rgbvec c100 = lut3d->lut[next[0]][prev[1]][prev[2]];
164 const struct rgbvec c101 = lut3d->lut[next[0]][prev[1]][next[2]];
165 c.
r = (1-d.
r) * c000.
r + (d.
r-d.
b) * c100.
r + (d.
b-d.
g) * c101.
r + (d.
g) * c111.
r;
166 c.
g = (1-d.
r) * c000.
g + (d.
r-d.
b) * c100.
g + (d.
b-d.
g) * c101.
g + (d.
g) * c111.
g;
167 c.
b = (1-d.
r) * c000.
b + (d.
r-d.
b) * c100.
b + (d.
b-d.
g) * c101.
b + (d.
g) * c111.
b;
169 const struct rgbvec c001 = lut3d->lut[prev[0]][prev[1]][next[2]];
170 const struct rgbvec c101 = lut3d->lut[next[0]][prev[1]][next[2]];
171 c.
r = (1-d.
b) * c000.
r + (d.
b-d.
r) * c001.
r + (d.
r-d.
g) * c101.
r + (d.
g) * c111.
r;
172 c.
g = (1-d.
b) * c000.
g + (d.
b-d.
r) * c001.
g + (d.
r-d.
g) * c101.
g + (d.
g) * c111.
g;
173 c.
b = (1-d.
b) * c000.
b + (d.
b-d.
r) * c001.
b + (d.
r-d.
g) * c101.
b + (d.
g) * c111.
b;
177 const struct rgbvec c001 = lut3d->lut[prev[0]][prev[1]][next[2]];
178 const struct rgbvec c011 = lut3d->lut[prev[0]][next[1]][next[2]];
179 c.
r = (1-d.
b) * c000.
r + (d.
b-d.
g) * c001.
r + (d.
g-d.
r) * c011.
r + (d.
r) * c111.
r;
180 c.
g = (1-d.
b) * c000.
g + (d.
b-d.
g) * c001.
g + (d.
g-d.
r) * c011.
g + (d.
r) * c111.
g;
181 c.
b = (1-d.
b) * c000.
b + (d.
b-d.
g) * c001.
b + (d.
g-d.
r) * c011.
b + (d.
r) * c111.
b;
182 }
else if (d.
b > d.
r) {
183 const struct rgbvec c010 = lut3d->lut[prev[0]][next[1]][prev[2]];
184 const struct rgbvec c011 = lut3d->lut[prev[0]][next[1]][next[2]];
185 c.
r = (1-d.
g) * c000.
r + (d.
g-d.
b) * c010.
r + (d.
b-d.
r) * c011.
r + (d.
r) * c111.
r;
186 c.
g = (1-d.
g) * c000.
g + (d.
g-d.
b) * c010.
g + (d.
b-d.
r) * c011.
g + (d.
r) * c111.
g;
187 c.
b = (1-d.
g) * c000.
b + (d.
g-d.
b) * c010.
b + (d.
b-d.
r) * c011.
b + (d.
r) * c111.
b;
189 const struct rgbvec c010 = lut3d->lut[prev[0]][next[1]][prev[2]];
190 const struct rgbvec c110 = lut3d->lut[next[0]][next[1]][prev[2]];
191 c.
r = (1-d.
g) * c000.
r + (d.
g-d.
r) * c010.
r + (d.
r-d.
b) * c110.
r + (d.
b) * c111.
r;
192 c.
g = (1-d.
g) * c000.
g + (d.
g-d.
r) * c010.
g + (d.
r-d.
b) * c110.
g + (d.
b) * c111.
g;
193 c.
b = (1-d.
g) * c000.
b + (d.
g-d.
r) * c010.
b + (d.
r-d.
b) * c110.
b + (d.
b) * c111.
b;
199 #define DEFINE_INTERP_FUNC(name, nbits) \
200 static struct rgbvec interp_##nbits##_##name(const LUT3DContext *lut3d, \
205 const float scale = (1. / ((1<<nbits) - 1)) * (lut3d->lutsize - 1); \
206 const struct rgbvec scaled_rgb = {r * scale, g * scale, b * scale}; \
207 return interp_##name(lut3d, &scaled_rgb); \
218 #define MAX_LINE_SIZE 512
224 return !*p || *p ==
'#';
227 #define NEXT_LINE(loop_cond) do { \
228 if (!fgets(line, sizeof(line), f)) { \
229 av_log(ctx, AV_LOG_ERROR, "Unexpected EOF\n"); \
230 return AVERROR_INVALIDDATA; \
242 for (k = 0; k <
size; k++) {
243 for (j = 0; j <
size; j++) {
244 for (i = 0; i <
size; i++) {
246 struct rgbvec *vec = &lut3d->
lut[k][j][i];
248 sscanf(line,
"%f %f %f", &vec->
r, &vec->
g, &vec->
b);
260 float min[3] = {0.0, 0.0, 0.0};
261 float max[3] = {1.0, 1.0, 1.0};
263 while (fgets(line,
sizeof(line), f)) {
264 if (!strncmp(line,
"LUT_3D_SIZE ", 12)) {
266 const int size = strtol(line + 12, NULL, 0);
273 for (k = 0; k <
size; k++) {
274 for (j = 0; j <
size; j++) {
275 for (i = 0; i <
size; i++) {
276 struct rgbvec *vec = &lut3d->
lut[k][j][i];
280 if (!strncmp(line,
"DOMAIN_", 7)) {
282 if (!strncmp(line + 7,
"MIN ", 4)) vals =
min;
283 else if (!strncmp(line + 7,
"MAX ", 4)) vals = max;
286 sscanf(line + 11,
"%f %f %f", vals, vals + 1, vals + 2);
288 min[0], min[1], min[2], max[0], max[1], max[2]);
292 if (sscanf(line,
"%f %f %f", &vec->
r, &vec->
g, &vec->
b) != 3)
294 vec->
r *= max[0] - min[0];
295 vec->
g *= max[1] - min[1];
296 vec->
b *= max[2] - min[2];
314 const float scale = 16*16*16;
318 for (k = 0; k <
size; k++) {
319 for (j = 0; j <
size; j++) {
320 for (i = 0; i <
size; i++) {
322 struct rgbvec *vec = &lut3d->
lut[k][j][i];
325 if (sscanf(line,
"%d %d %d", &r, &g, &b) != 3)
343 uint8_t rgb_map[3] = {0, 1, 2};
345 while (fgets(line,
sizeof(line), f)) {
346 if (!strncmp(line,
"in", 2)) in = strtol(line + 2, NULL, 0);
347 else if (!strncmp(line,
"out", 3))
out = strtol(line + 3, NULL, 0);
348 else if (!strncmp(line,
"values", 6)) {
349 const char *p = line + 6;
350 #define SET_COLOR(id) do { \
351 while (av_isspace(*p)) \
354 case 'r': rgb_map[id] = 0; break; \
355 case 'g': rgb_map[id] = 1; break; \
356 case 'b': rgb_map[id] = 2; break; \
358 while (*p && !av_isspace(*p)) \
368 if (in == -1 ||
out == -1) {
372 if (in < 2 ||
out < 2 ||
378 for (size = 1; size*size*size <
in; size++);
380 scale = 1. / (
out - 1);
382 for (k = 0; k <
size; k++) {
383 for (j = 0; j <
size; j++) {
384 for (i = 0; i <
size; i++) {
385 struct rgbvec *vec = &lut3d->
lut[k][j][i];
389 if (sscanf(line,
"%f %f %f", val, val + 1, val + 2) != 3)
391 vec->
r = val[rgb_map[0]] *
scale;
392 vec->
g = val[rgb_map[1]] *
scale;
393 vec->
b = val[rgb_map[2]] *
scale;
403 const float c = 1. / (size - 1);
406 for (k = 0; k <
size; k++) {
407 for (j = 0; j <
size; j++) {
408 for (i = 0; i <
size; i++) {
409 struct rgbvec *vec = &lut3d->
lut[k][j][i];
450 #define SET_FUNC(name) do { \
451 if (lut3d->is16bit) lut3d->interp_16 = interp_16_##name; \
452 else lut3d->interp_8 = interp_8_##name; \
466 #define FILTER(nbits) do { \
467 uint8_t *dstrow = out->data[0]; \
468 const uint8_t *srcrow = in ->data[0]; \
470 for (y = 0; y < inlink->h; y++) { \
471 uint##nbits##_t *dst = (uint##nbits##_t *)dstrow; \
472 const uint##nbits##_t *src = (const uint##nbits##_t *)srcrow; \
473 for (x = 0; x < inlink->w * step; x += step) { \
474 struct rgbvec vec = lut3d->interp_##nbits(lut3d, src[x + r], src[x + g], src[x + b]); \
475 dst[x + r] = av_clip_uint##nbits(vec.r * (float)((1<<nbits) - 1)); \
476 dst[x + g] = av_clip_uint##nbits(vec.g * (float)((1<<nbits) - 1)); \
477 dst[x + b] = av_clip_uint##nbits(vec.b * (float)((1<<nbits) - 1)); \
478 if (!direct && step == 4) \
479 dst[x + a] = src[x + a]; \
481 dstrow += out->linesize[0]; \
482 srcrow += in ->linesize[0]; \
488 int x,
y, direct = 0;
493 const int step = lut3d->
step;
529 #if CONFIG_LUT3D_FILTER
530 static const AVOption lut3d_options[] = {
549 f = fopen(lut3d->
file,
"r");
556 ext = strrchr(lut3d->
file,
'.');
614 .priv_class = &lut3d_class,
619 #if CONFIG_HALDCLUT_FILTER
624 const int linesize = frame->
linesize[0];
625 const int w = lut3d->clut_width;
626 const int step = lut3d->clut_step;
627 const uint8_t *rgba_map = lut3d->clut_rgba_map;
630 #define LOAD_CLUT(nbits) do { \
631 int i, j, k, x = 0, y = 0; \
633 for (k = 0; k < level; k++) { \
634 for (j = 0; j < level; j++) { \
635 for (i = 0; i < level; i++) { \
636 const uint##nbits##_t *src = (const uint##nbits##_t *) \
637 (data + y*linesize + x*step); \
638 struct rgbvec *vec = &lut3d->lut[k][j][i]; \
639 vec->r = src[rgba_map[0]] / (float)((1<<(nbits)) - 1); \
640 vec->g = src[rgba_map[1]] / (float)((1<<(nbits)) - 1); \
641 vec->b = src[rgba_map[2]] / (float)((1<<(nbits)) - 1); \
651 if (!lut3d->clut_is16bit) LOAD_CLUT(8);
689 lut3d->clut_is16bit = 0;
695 lut3d->clut_is16bit = 1;
701 if (inlink->
w > inlink->
h)
703 "Hald CLUT will be ignored\n", inlink->
w - inlink->
h);
704 else if (inlink->
w < inlink->
h)
706 "Hald CLUT will be ignored\n", inlink->
h - inlink->
w);
707 lut3d->clut_width = w = h =
FFMIN(inlink->
w, inlink->
h);
709 for (level = 1; level*level*level < w; level++);
710 size = level*level*
level;
718 const int max_clut_level = sqrt(
MAX_LEVEL);
719 const int max_clut_size = max_clut_level*max_clut_level*max_clut_level;
721 "(maximum level is %d, or %dx%d CLUT)\n",
722 max_clut_level, max_clut_size, max_clut_size);
734 update_clut(ctx->
priv, second);
741 lut3d->dinput.process = update_apply_clut;
751 static const AVOption haldclut_options[] = {
752 {
"shortest",
"force termination when the shortest input terminates",
OFFSET(dinput.shortest),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
FLAGS },
753 {
"repeatlast",
"continue applying the last clut after eos",
OFFSET(dinput.repeatlast),
AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1,
FLAGS },
763 .filter_frame = filter_frame_hald,
768 .filter_frame = filter_frame_hald,
769 .config_props = config_clut,
788 .
init = haldclut_init,
789 .
uninit = haldclut_uninit,
791 .
inputs = haldclut_inputs,
793 .priv_class = &haldclut_class,
const char const char void * val
static int config_input(AVFilterLink *inlink)
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.
const char * name
Filter name.
void * priv
private data for use by the filter
#define AV_LOG_WARNING
Something somehow does not look correct.
static const AVFilterPad outputs[]
static av_cold int init(AVCodecContext *avctx)
int h
agreed upon image height
packed RGB 8:8:8, 24bpp, RGBRGB...
static int skip_line(const char *p)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
static int parse_cube(AVFilterContext *ctx, FILE *f)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
packed RGB 8:8:8, 32bpp, RGB0RGB0...
packed BGR 8:8:8, 32bpp, 0BGR0BGR...
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
packed RGB 8:8:8, 24bpp, BGRBGR...
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static float lerpf(float v0, float v1, float f)
static av_cold int uninit(AVCodecContext *avctx)
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static av_cold int end(AVCodecContext *avctx)
enum interp_mode interpolation
static void set_identity_matrix(LUT3DContext *lut3d, int size)
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
#define AV_PIX_FMT_RGBA64
A filter pad used for either input or output.
A link between two filters.
#define av_err2str(errnum)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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){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));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=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);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);ff_audio_convert_init_arm(ac);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_dlog(ac->avr,"%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
#define DEFINE_INTERP_FUNC(name, nbits)
packed BGR 8:8:8, 32bpp, BGR0BGR0...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static struct rgbvec interp_nearest(const LUT3DContext *lut3d, const struct rgbvec *s)
Get the nearest defined point.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
AVFilterContext * src
source filter
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
AVPixelFormat
Pixel format.
int w
agreed upon image width
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
struct rgbvec(* interp_8)(const struct LUT3DContext *, uint8_t, uint8_t, uint8_t)
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)
Main libavfilter public API header.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
AVFilterLink ** outputs
array of pointers to output links
#define AV_LOG_INFO
Standard information.
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)
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
AVFilterLink ** inputs
array of pointers to input links
#define AV_PIX_FMT_BGRA64
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
AVFilterContext * dst
dest filter
#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.
static const uint16_t scale[4]
struct rgbvec(* interp_16)(const struct LUT3DContext *, uint16_t, uint16_t, uint16_t)
static int config_output(AVFilterLink *outlink)
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
#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)
static int parse_dat(AVFilterContext *ctx, FILE *f)
#define AVERROR_INVALIDDATA
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){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));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=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);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);ff_audio_convert_init_arm(ac);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_dlog(ac->avr,"%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-> out
#define AVFILTER_DEFINE_CLASS(fname)
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
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 int request_frame(AVFilterLink *outlink)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int query_formats(AVFilterContext *ctx)
int main(int argc, char **argv)
packed RGB 8:8:8, 32bpp, 0RGB0RGB...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
struct rgbvec lut[MAX_LEVEL][MAX_LEVEL][MAX_LEVEL]