Go to the documentation of this file.
56 {0.5774, 0.5774, 0.5774},
57 {0.40825, 0.40825, -0.816458},
62 {0.57735, 0.40825, 0.707},
63 {0.57735, 0.40825, -0.707},
68 {0.3811, 0.5783, 0.0402},
69 {0.1967, 0.7244, 0.0782},
70 {0.0241, 0.1288, 0.8444}
74 {4.4679, -3.5873, 0.1193},
75 {-1.2186, 2.3809, -0.1624},
76 {0.0497, -0.2439, 1.2045}
90 lms[0] = lms[0] > 0.f ? logf(lms[0]) : -1024.f;
91 lms[1] = lms[1] > 0.f ? logf(lms[1]) : -1024.f;
92 lms[2] = lms[2] > 0.f ? logf(lms[2]) : -1024.f;
107 lms[0] =
expf(lms[0]);
108 lms[1] =
expf(lms[1]);
109 lms[2] =
expf(lms[2]);
130 const int slice_end = (
out->height * (jobnr + 1)) / nb_jobs;
131 float rgb[3], lab[3];
134 float *b_in_row = (
float *)(in->
data[1] +
i * in->
linesize[1]);
135 float *g_in_row = (
float *)(in->
data[0] +
i * in->
linesize[0]);
136 float *r_in_row = (
float *)(in->
data[2] +
i * in->
linesize[2]);
137 float *acur =
s->tmpplab +
i * outlink->
w + outlink->
w * outlink->
h;
138 float *bcur =
s->tmpplab +
i * outlink->
w + 2 * outlink->
w * outlink->
h;
139 float *lcur =
s->tmpplab +
i * outlink->
w;
141 s->line_sum[
i] = 0.f;
142 s->line_sum[
i + outlink->
h] = 0.f;
143 s->line_count_pels[
i] = 0;
145 for (
int j = 0; j < outlink->
w; j++) {
146 rgb[0] = r_in_row[j];
147 rgb[1] = g_in_row[j];
148 rgb[2] = b_in_row[j];
153 s->line_sum[
i] += lab[1];
154 s->line_sum[
i + outlink->
h] += lab[2];
155 s->line_count_pels[
i]++;
169 float asum = 0.f, bsum = 0.f;
172 for (
int y = 0; y < td->
out->
height; y++) {
173 asum +=
s->line_sum[y];
175 pixels +=
s->line_count_pels[y];
178 td->
a_avg = asum / pixels;
179 td->
b_avg = bsum / pixels;
197 const int slice_end = (
out->height * (jobnr + 1)) / nb_jobs;
198 float rgb[3], lab[3];
201 float *g_out_row = (
float *)(
out->data[0] +
i *
out->linesize[0]);
202 float *b_out_row = (
float *)(
out->data[1] +
i *
out->linesize[1]);
203 float *r_out_row = (
float *)(
out->data[2] +
i *
out->linesize[2]);
204 float *lcur =
s->tmpplab +
i * outlink->
w;
205 float *acur =
s->tmpplab +
i * outlink->
w + outlink->
w * outlink->
h;
206 float *bcur =
s->tmpplab +
i * outlink->
w + 2 * outlink->
w * outlink->
h;
208 for (
int j = 0; j < outlink->
w; j++) {
219 r_out_row[j] =
rgb[0];
220 g_out_row[j] =
rgb[1];
221 b_out_row[j] =
rgb[2];
234 if (!
s->tmpplab || !
s->line_count_pels || !
s->line_sum)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
enum AVColorTransferCharacteristic color_trc
#define AV_LOG_WARNING
Something somehow does not look correct.
static int convert_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Convert a frame from linear RGB to logspace LAB, and accumulate channel totals for each row Convert f...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
static av_cold void uninit(AVFilterContext *ctx)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
const char * name
Filter name.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
#define FF_ALLOC_TYPED_ARRAY(p, nelem)
static void compute_correction(GrayWorldContext *s, ThreadData *td)
Sum the channel totals and compute the mean for each channel.
A filter pad used for either input or output.
static const float lms2rgb[3][3]
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
static void lab2rgb(const float lab[3], float rgb[3])
Convert from Logspace LAB to Linear RGB.
static void apply_matrix(const float matrix[3][3], const float input[3], float output[3])
#define FILTER_OUTPUTS(array)
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
const AVFilter ff_vf_grayworld
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int config_input(AVFilterLink *inlink)
#define AV_PIX_FMT_GBRPF32
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define i(width, name, range_min, range_max)
int w
agreed upon image width
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
const char * name
Pad name.
#define FILTER_PIXFMTS(...)
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
static const float rgb2lms[3][3]
static void rgb2lab(const float rgb[3], float lab[3])
Convert from Linear RGB to logspace LAB.
static const float lms2lab[3][3]
int h
agreed upon image height
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
#define AV_PIX_FMT_GBRAPF32
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
static const float lab2lms[3][3]
static int correct_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Subtract the mean logspace AB values from each pixel.
static const AVFilterPad grayworld_inputs[]